cf/mirror

The Shortest Statement

CF
1051F2400· grandmaster4s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
3 3
1 2 3
2 3 1
3 1 5
3
1 2
1 3
2 3
Output
3
4
1
Sample 2of 2
Input
8 13
1 2 4
2 3 6
3 4 1
4 5 12
5 6 3
6 7 8
7 8 7
1 4 1
1 8 3
2 6 9
2 7 1
4 6 3
6 8 2
8
1 5
1 7
2 3
2 8
3 7
3 4
6 8
7 8
Output
7
5
6
7
7
1
2
7
1051F.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…