Given a directed graph with $N$ vertices and $M$ edges. $i$-th edge is $(a_ i, b_ i)$.
Calculate the dominator tree of this graph whose root is $S$.
$N$ $M$ $S$
$a_ 0$ $b_ 0$
$a_ 1$ $b_ 1$
:
$a_ {M - 1}$ $b_ {M - 1}$
$p_ 0$ $p_ 1$ $p_ 2$ ... $p_ {N - 1}$
$p_ i$ is the parent of vertex $i$. If we can not reach $i$ from $S$, print $-1$. $p_ S$ is $S$.
5 6 0 0 1 1 2 2 3 3 4 0 3 2 4
0 0 1 0 0
8 8 4 4 2 4 3 2 0 3 0 0 1 3 5 3 6 7 6
4 0 4 4 4 3 3 -1
| No. | Testdata Range | Score |
|---|