Solve the Single Source Shortest Path problem.
Input Specification
Line
Lines
Output Specification
Lines -1
.
Sample Input
Copy
4 3
1 2 2
1 3 5
2 3 2
Sample Output
Copy
0
2
4
-1
Solve the Single Source Shortest Path problem.
Line
Lines
Lines -1
.
4 3
1 2 2
1 3 5
2 3 2
0
2
4
-1
Comments