cf/mirror

Spinning Round (Easy Version)

CF
1987G12900· international gm7s1024 MB⌨ stdin/stdout

Examples

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