Problem M
Single source shortest path, non-negative weights
Input
The input consists of several test cases. Each test case
starts with a line with four non-negative integers,
Input will be terminated by a line containing four zeros, this line should not be processed.
Output
For each query, output a single line containing the minimum
distance from node
Sample Input 1 | Sample Output 1 |
---|---|
4 3 4 0 0 1 2 1 2 2 3 0 2 0 1 2 3 2 1 1 0 0 1 100 1 0 0 0 0 |
0 2 4 Impossible 100 |