Score : $600$ points
We have a directed graph with $N$ vertices. The $N$ vertices are called Vertex $1$, Vertex $2$, $\ldots$, Vertex $N$. At time $0$, the graph has no edge.
For each $t = 1, 2, \ldots, T$, at time $t$, a directed edge from Vertex $u_t$ to Vertex $v_t$ will be added. (The edge may be a self-loop, that is, $u_t = v_t$ may hold.)
A vertex is called good when it can be reached by starting at Vertex $1$ and traversing an edge exactly $L$ times.
For each $i = 1, 2, \ldots, N$, print the earliest time when Vertex $i$ is good. If there is no time when Vertex $i$ is good, print $-1$ instead.
Input is given from Standard Input in the following format:
$N$ $T$ $L$ $u_1$ $v_1$ $u_2$ $v_2$ $\vdots$ $u_T$ $v_T$
In the following format, for each $i = 1, 2, \ldots, N$, print the earliest time $X_i$ when Vertex $i$ is good. If there is no time when Vertex $i$ is good, $X_i$ should be $-1$.
$X_1$ $X_2$ $\ldots$ $X_N$
4 5 3 2 3 3 4 1 2 3 2 2 2
-1 4 5 3
At time $0$, the graph has no edge. Afterward, edges are added as follows.
Vertex $1$ will never be good.
2 1 1000000000 1 2
-1 -1