vector g[100001];
vector visi(100001, 0);
//-> in out time of a node
vector In(100001);
vector Out(100001);
ll Time = 1;
void in_out_time(ll v)
{
visi[v] = 1;
In[v] = Time;
Time++;
for (ll child : g[v]) {
if (visi[child] == 0)
in_out_time(child);
}
Out[v] = Time;
Time++;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter