Codeforces Round 733 (Div. 1 + Div. 2, based on VK Cup 2021 - Elimination (Engine))


A. Binary Decimal
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
121
5
1000000000
Output
2
5
1
----------------------------------------------------------------------------------------------------
B. Putting Plates
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
3 5
4 4
5 6
Output
10101
00000
10101
0100
0001
1000
0010
010101
000000
100001
000000
101010
----------------------------------------------------------------------------------------------------
C. Pursuit
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
1
100
0
1
0
100
4
20 30 40 50
100 100 100 100
4
10 20 30 40
100 100 100 100
7
7 59 62 52 27 31 55
33 35 50 98 83 80 64
Output
0
1
3
4
2
----------------------------------------------------------------------------------------------------
D. Secret Santa
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
3
2 1 2
7
6 4 6 2 4 5 6
Output
2
3 1 2
4
6 4 7 2 3 5 1
----------------------------------------------------------------------------------------------------
E. Minimax
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
vkcup
abababa
zzzzzz
Output
ckpuv
aababab
zzzzzz
----------------------------------------------------------------------------------------------------
F. Bingo
time limit per test: 7 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2
5000 5000
5000 5000
Output
5927
Input
2
2500 6000
3000 4000
Output
24812
Input
3
1000 2000 3000
4000 5000 6000
7000 8000 9000
Output
25267
----------------------------------------------------------------------------------------------------
G. What a Reversal
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6
6 1
101010
010101
6 3
101010
010101
6 0
101010
010101
6 6
101010
010101
4 2
0000
1111
9 2
011100101
101001011
Output
3
1 2
3 4
5 6
1
1 6
-1
-1
-1
5
4 8
8 9
3 6
1 4
3 6
----------------------------------------------------------------------------------------------------
H. Turing's Award
time limit per test: 10 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
2
1 2
4
4 1 2 3
7
3 6 5 7 4 1 2
7
5 2 3 7 6 1 4
Output
2
3
4
4
----------------------------------------------------------------------------------------------------
