cf/mirror

Dynamic Shortest Path

CF
843D3400· legendary gm10s512 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
3 2 9
1 2 0
2 3 0
2 1 2
1 3
1 2
2 1 1
1 3
1 2
2 2 1 2
1 3
1 2
Output
1
0
2
1
4
2
Sample 2of 2
Input
5 4 9
2 3 1
2 4 1
3 4 1
1 2 0
1 5
1 4
2 1 2
2 1 2
1 4
2 2 1 3
1 4
2 1 4
1 4
Output
-1
1
2
3
4
843D.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…