cf/mirror

Stop Gaming (Hard Version)

CF
2059E22900· international gm3s256 MB⌨ stdin/stdout

Examples

Sample 1of 1
Input
4
2 2
2 6
3 4
1 2
7 8
1 5
5 4 1 2 3
5 4 3 2 1
3 3
1 2 3
4 5 6
7 8 9
11 1 2
12 3 4
13 5 6
4 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 1 2 3
4 18 5 6
7 19 8 20
9 21 22 10
Output
3
1 1
2 8
2 7
5
1 1
1 2
1 3
1 4
1 5
3
1 11
2 12
3 13
6
3 20
2 18
3 19
4 22
4 21
1 17
2059E2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)