Codeforces Round 634 (Div. 3)


A. Candies and Two Sisters
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
7
1
2
3
2000000000
763243547
Output
3
0
0
1
999999999
381621773
----------------------------------------------------------------------------------------------------
B. Construct the String
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
7 5 3
6 1 1
6 6 1
5 2 2
Output
tleelte
qwerty
vvvvvv
abcde
----------------------------------------------------------------------------------------------------
C. Two Teams Composing
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
7
4 2 4 1 4 3 4
5
2 1 5 4 3
1
1
4
1 1 1 3
Output
3
1
0
2
----------------------------------------------------------------------------------------------------
D. Anti-Sudoku
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
154873296
386592714
729641835
863725149
975314628
412968357
631457982
598236471
247189563
Output
154873396
336592714
729645835
863725145
979314628
412958357
631457992
998236471
247789563
----------------------------------------------------------------------------------------------------
E1. Three Blocks Palindrome (easy version)
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
8
1 1 2 2 3 2 1 1
3
1 3 3
4
1 10 10 1
1
26
2
2 1
3
1 1 1
Output
7
2
4
1
1
3
----------------------------------------------------------------------------------------------------
E2. Three Blocks Palindrome (hard version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
8
1 1 2 2 3 2 1 1
3
1 3 3
4
1 10 10 1
1
26
2
2 1
3
1 1 1
Output
7
2
4
1
1
3
----------------------------------------------------------------------------------------------------
F. Robots on a Grid
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2
01
RL
3 3
001
101
110
RLL
DLD
ULL
3 3
000
000
000
RRD
RLD
ULL
Output
2 1
4 3
2 2
----------------------------------------------------------------------------------------------------
