cf/mirror

Spinning Round (Hard Version)

CF
1987G23500· legendary gm7s1024 MB⌨ stdin/stdout

Examples

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