Educational Codeforces Round 85 (Rated for Div. 2)


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

Examples
Input
6
3
0 0
1 1
1 2
2
1 0
1000 3
4
10 1
15 2
10 2
15 2
1
765 432
2
4 4
4 3
5
0 0
1 0
1 0
1 0
1 0
Output
NO
YES
NO
YES
NO
YES
----------------------------------------------------------------------------------------------------
B. Middle Class
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4 3
5 1 2 1
4 10
11 9 11 9
2 5
4 3
3 7
9 4 9
Output
2
4
0
3
----------------------------------------------------------------------------------------------------
C. Circle of Monsters
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
3
7 15
2 14
5 3
Output
6
----------------------------------------------------------------------------------------------------
D. Minimum Euler Cycle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 1 3
3 3 6
99995 9998900031 9998900031
Output
1 2 1 
1 3 2 3 
1 
----------------------------------------------------------------------------------------------------
E. Divisor Paths
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
12
3
4 4
12 1
3 4
Output
1
3
1
Input
1
1
1 1
Output
1
Input
288807105787200
4
46 482955026400
12556830686400 897
414 12556830686400
4443186242880 325
Output
547558588
277147129
457421435
702277623
----------------------------------------------------------------------------------------------------
F. Strange Function
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
4 1 3 3 7 8 7 9 10 7 11
3 5 0 -2 5 3 6 7 8 2 4
3
3 7 10
Output
YES
20
Input
6
2 1 5 3 6 5
3 -9 0 16 22 -14
4
2 3 5 6
Output
NO
----------------------------------------------------------------------------------------------------
G. Substring Search
time limit per test: 1.25 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2 3 1 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
abc
abcaaba
Output
11001
----------------------------------------------------------------------------------------------------
