Problem Statement
Planets Queries II
Implementation
vector<ll> v[N], revv[N], topo;
bool vis1[N], vis2[N];
void dfs1(ll node) {
vis1[node] = 1;
for (auto child : v[node]) {
if (!vis1[child]) {
dfs1(child);
}
}
topo.pb(node);
}
void dfs2(ll node) {
vis2[node] = 1;
for (auto child : revv[node]) {
if (!vis2[child]) {
dfs2(child);
}
}
}
void solve() {
}