cf/mirror

King's Path

CF
1211G2500· grandmaster5s256 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
1
7
2 3 2 7 1 1 3
7 1 2 3 1 2 3
1 7
4 1
2 6
2 3
2 4
5 4
Output
Yes
4
1 4 2 6
Sample 2of 3
Input
1
5
1 2 2 2 2
2 2 2 2 1
1 2
2 3
3 4
4 5
Output
Yes
5
1 2 3 4 5
Sample 3of 3
Input
3
4
10 20 10 20
20 10 20 10
1 2
1 3
1 4
2
1000000 1000000
1000000 1000000
1 2
10
4 2 2 4 2 4 1 2 3 4
4 2 4 4 3 2 1 2 4 2
5 8
6 9
10 5
1 10
7 10
3 4
5 9
3 10
2 4
Output
No
Yes
0
Yes
5
3 10 5 9 6
1211G.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…