cf/mirror

A Simple Problem

CF
2210F2700· international gm5s1024 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
4
2 2
1 2
1 1
1 2
2 1
2 1
1 2
5 2
1 2 3 4 5
1 4
2 5
10 6
7 10 5 2 8 3 6 4 9 1
1 6
1 10
6 9
5 10
2 8
6 7
Output
0
0
1
2
2
11
31
2
11
13
0
2210F.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…