#P11964. Reachable Vertices Count
Reachable Vertices Count
Reachable Vertices Count
Given an undirected graph with vertices and edges (vertices are numbered ), you need to answer the following: For each vertex (), if you start at vertex and move exactly steps (where ) with each move going to any adjacent vertex, compute the number of distinct vertices you can reach. Formally, let be the set of vertices that can be reached from vertex in exactly moves. You only need to output the size of for each vertex and each step count .
inputFormat
The input begins with a single line containing three integers , , and , where:
- $n$ is the number of vertices,
- $m$ is the number of edges, and
- $k$ is the maximum number of moves to simulate.
outputFormat
Output lines. The -th line must contain integers separated by spaces, where the -th integer is the number of distinct vertices that can be reached from vertex in exactly moves.
sample
3 2 2
1 2
2 3
1 2
2 1
1 2
</p>