cf/mirror

The Classic Problem

CF
464E3000· legendary gm5s768 MB⌨ stdin/stdout

Examples

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