Codeforces Round 810 (Div. 2)


A. Perfect Permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1
4
Output
1
2 1 4 3
----------------------------------------------------------------------------------------------------
B. Party
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 0
1
3 1
2 1 3
1 3
5 5
1 2 3 4 5
1 2
1 3
1 4
1 5
2 3
5 5
1 1 1 1 1
1 2
2 3
3 4
4 5
5 1
Output
0
2
3
2
----------------------------------------------------------------------------------------------------
C. Color the Picture
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
4 6 3
12 9 8
3 3 2
8 8
3 3 2
9 5
4 5 2
10 11
5 4 2
9 11
10 10 3
11 45 14
Output
Yes
No
Yes
Yes
No
No
----------------------------------------------------------------------------------------------------
D. Rain
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3 6
1 5
5 5
3 4
2 3
1 3
5 2
2 5
1 6
10 6
6 12
4 5
1 6
12 5
5 5
9 7
8 3
Output
001
11
00
100110
----------------------------------------------------------------------------------------------------
E. XOR Triangle
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
101
Output
12
Input
1110
Output
780
Input
11011111101010010
Output
141427753
----------------------------------------------------------------------------------------------------
