Breadth First Search 0-1
Very easy
Execution time limit is 3 seconds
Runtime memory usage limit is 128 megabytes
Undirected graph is given. The weights of its edges can be or only. Find the shortest distance from source to destination .
Input
The first line contains four integers: number of vertices , number of edges , source and destination . Each of the next lines contains three integers and describing an undirected edge with integer weight .
Output
Print the shortest distance from to .
Examples
Input #1
Answer #1
Submissions 2K
Acceptance rate 48%