Educational Codeforces Round 100 (Rated for Div. 2)


A. Dungeon
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 2 4
1 1 1
10 1 7
Output
YES
NO
NO
----------------------------------------------------------------------------------------------------
B. Find The Array
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5
1 2 3 4 5
2
4 6
2
1 1000000000
6
3 4 8 1 2 3
Output
3 3 3 3 3
3 6
1 1000000000
4 4 8 1 3 3
----------------------------------------------------------------------------------------------------
C. Busy Robot
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
3
1 5
3 0
6 4
3
1 5
2 4
10 -5
5
2 -5
3 1
4 1
5 1
6 1
4
3 3
5 -3
9 2
12 0
8
1 1
2 -6
7 2
8 3
12 -9
14 2
18 -1
23 9
5
1 -4
4 -7
6 -1
7 -3
8 -7
2
1 2
2 -2
6
3 10
5 5
8 0
12 -4
14 -7
19 -5
Output
1
2
0
2
1
1
0
2
----------------------------------------------------------------------------------------------------
D. Pairs
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1
1
5
1 4 5 9 10
2
3 4
Output
1
3
1
----------------------------------------------------------------------------------------------------
E. Plan of Lectures
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5 2
2 3 0 5 3
1 5
5 4
Output
3 2 1 5 4
Input
5 2
2 3 0 5 3
1 5
5 1
Output
0
Input
5 1
2 3 0 5 3
4 5
Output
0
Input
5 4
2 3 0 5 3
2 1
3 5
5 2
1 4
Output
3 5 2 1 4
----------------------------------------------------------------------------------------------------
F. Max Correct Set
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 2 5
Output
5
Input
21 4 6
Output
9
Input
1337 7 7
Output
672
Input
455678451 22 17
Output
221997195
----------------------------------------------------------------------------------------------------
