cf/mirror

Construct an Array (Hard Version)

CF
2245D24s1024 MB⌨ stdin/stdout

Examples

Sample 1of 1multi-test • hover to link
Input
10
1 1
1 1 1
1 1
2 1 1
2 3
1 1 1
1 1 2
1 2 2
2 3
1 1 1
1 2 2
2 1 2
3 6
1 1 1
1 1 2
1 1 3
2 2 2
2 2 3
2 3 3
3 6
2 1 1
1 1 2
2 2 3
1 3 3
1 2 2
2 1 3
2 1
2 1 2
3 4
1 1 2
1 2 3
2 1 3
2 2 2
4 0
7 7
1 1 2
2 2 3
1 3 4
2 4 5
1 5 6
2 6 7
1 7 7
Output
YES
0
YES
-1
YES
0 0
NO
YES
1 -1 -1
NO
YES
-1 -1
NO
YES
0 0 0 0
YES
6 -6 4 -4 2 -2 0
2245D2.cpp
loading editor…
Ln 11·137 BGNU C++20 (64)
loading graph engine…