cf/mirror

Cheops and a Contest (Hard Version)

CF
2046E23500· legendary gm4s512 MB⌨ stdin/stdout

Examples

Sample 1of 1
Input
2
5 2
5 7 1
6 7 2
3 9 2
5 10 3
4 4 1
2 1 2
3 3 4 5
2 2
1 2 1
1 2 1
1 2
1 1
Output
7
6 4
6 5
5 6
5 7
4 8
4 9
7 1
-1
2046E2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)