cf/mirror

Linear Kingdom Races

CF
115E2400· grandmaster3s256 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
7 4
3
2
3
2
1
2
3
1 2 5
2 3 5
3 5 3
7 7 5
Output
4
Sample 2of 3
Input
2 1
0
3
1 2 5
Output
2
Sample 3of 3
Input
3 1
10
10
10
1 3 10
Output
0
115E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)