Path
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
In an undirected graph is required to find a minimal path between two vertices.
Input
In the input file is written first, the number N - the number of vertices in the graph (1 ≤ N ≤ 100). Then write the adjacency matrix (0 denotes the absence of ribs, 1 - presence of an edge). Then write the number two peaks - the start and end.
Output
The output display file L - length of the shortest path (number of edges that need to go). If the path does not exist, output a single number -1.
Examples
Input #1
Answer #1
Submissions 3K
Acceptance rate 35%