Educational Codeforces Round 111 (Rated for Div. 2)


A. Find The Array
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1
8
7
42
Output
1
3
3
7
----------------------------------------------------------------------------------------------------
B. Maximum Cost Deletion
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 2 0
000
5 -2 5
11001
6 1 -4
100111
Output
6
15
-2
----------------------------------------------------------------------------------------------------
C. Manhattan Subarrays
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
2 4 1 3
5
6 9 1 9 6
2
13 37
Output
10
12
3
----------------------------------------------------------------------------------------------------
D. Excellent Arrays
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3 0 3
4 -3 5
42 -33 55
69 -42 146
Output
4
10
143922563
698570404
----------------------------------------------------------------------------------------------------
E. Stringforces
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 2
a??ab????b
Output
4
Input
9 4
?????????
Output
2
Input
2 3
??
Output
0
Input
15 3
??b?babbc??b?aa
Output
3
Input
4 4
cabd
Output
1
----------------------------------------------------------------------------------------------------
F. Jumping Around
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 4 4 5
1 5 10 13 20 22 28
4 1
7 2
7 3
3 2
Output
Yes
No
Yes
Yes
Input
10 8 6 11
1 2 4 7 8 9 11 13 19 20
2 13
5 8
8 1
6 15
1 15
2 7
7 6
8 9
Output
Yes
Yes
No
Yes
Yes
Yes
Yes
Yes
Input
6 9 6 6
1 2 4 9 18 19
2 17
1 18
5 4
2 11
5 17
6 8
4 3
3 3
6 6
Output
Yes
Yes
Yes
Yes
Yes
Yes
No
No
Yes
Input
4 1 1 10
1 8 10 19
2 1
Output
Yes
----------------------------------------------------------------------------------------------------
