cf/mirror

Noble Knight's Path

CF
226E2900· international gm4s256 MB⌨ stdin/stdout

Examples

Sample 1of 2
Input
3
0 1 2
5
2 1 3 1 0
1 2
2 1 3 1 0
2 1 3 1 1
2 1 3 1 2
Output
2
-1
-1
2
Sample 2of 2
Input
6
2 5 2 2 0 5
3
2 1 6 2 0
1 2
2 4 5 1 0
Output
5
-1
226E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…