Educational Codeforces Round 128 (Rated for Div. 2)


A. Minimums and Maximums
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
7
3 5 4 6
5 8 5 5
3 3 10 12
1 5 3 3
1 1 2 2
2 2 1 1
6 6 6 6
Output
4
5
13
3
3
3
6
----------------------------------------------------------------------------------------------------
B. Robots
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6
1 3
ERR
2 2
ER
RE
2 2
ER
ER
1 1
R
4 3
EEE
EEE
ERR
EER
3 3
EEE
EER
REE
Output
YES
NO
YES
YES
YES
NO
----------------------------------------------------------------------------------------------------
C. Binary String
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
101110110
1001001001001
0000111111
00000
1111
Output
1
3
0
0
0
----------------------------------------------------------------------------------------------------
D. Dog Walking
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
5 0 -4
Output
6
Input
6 4
1 -2 0 3 -4 5
Output
7
Input
3 1000000000
0 0 0
Output
1000000001
Input
5 9
-7 -3 8 12 0
Output
-1
Input
5 3
-1 0 3 3 0
Output
7
Input
5 4
0 2 0 3 0
Output
9
----------------------------------------------------------------------------------------------------
E. Moving Chips
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1
*
.
2
.*
**
3
*.*
.*.
4
**.*
**..
5
**...
...**
Output
0
2
3
5
5
----------------------------------------------------------------------------------------------------
F. Lenient Vertex Cover
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
6 5
1 3
2 4
3 4
3 5
4 6
4 6
1 2
2 3
3 4
1 4
1 3
2 4
8 11
1 3
2 4
3 5
4 6
5 7
6 8
1 2
3 4
5 6
7 8
7 2
4 5
1 2
2 3
3 4
1 3
2 4
Output
YES
001100
NO
YES
01100110
YES
0110
Input
1
10 15
9 4
3 4
6 4
1 2
8 2
8 3
7 2
9 5
7 8
5 10
1 4
2 10
5 3
5 7
2 9
Output
YES
0101100100
Input
1
10 19
7 9
5 3
3 4
1 6
9 4
1 4
10 5
7 1
9 2
8 3
7 3
10 9
2 10
9 8
3 2
1 5
10 7
9 5
1 2
Output
YES
1010000011
----------------------------------------------------------------------------------------------------
