cf/mirror

Ambiguous Dominoes

CF
1695E2700· international gm8s256 MB⌨ stdin/stdout

Examples

Sample 1of 3
Input
1
1 2
Output
-1
Sample 2of 3
Input
2
1 1
1 2
Output
2 2
 
2 1
1 1
 
LR
LR
 
UU
DD
Sample 3of 3
Input
10
1 3
1 1
2 1
3 4
1 5
1 5
3 1
2 4
3 3
4 1
Output
4 5
 
1 2 5 1 5
3 4 1 3 1
1 2 4 4 1
1 3 3 3 1
 
LRULR
LRDLR
ULRLR
DLRLR
 
UULRU
DDUUD
LRDDU
LRLRD
1695E.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…