cf/mirror

The Game (Easy Version)

CF
2062E12000· candidate master4s512 MB⌨ stdin/stdout

Examples

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