Educational Codeforces Round 30


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

Examples
Input
4 2 2
3 6 7 10
Output
13
Input
5 2 1
100 100 100 100 100
Output
302
----------------------------------------------------------------------------------------------------
B. Balanced Substring
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
11010111
Output
4
Input
3
111
Output
0
----------------------------------------------------------------------------------------------------
C. Strange Game On Matrix
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3 2
0 1 0
1 0 1
0 1 0
1 1 1
Output
4 1
Input
3 2 1
1 0
0 1
0 0
Output
2 0
----------------------------------------------------------------------------------------------------
D. Merge Sort
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
Output
2 1 3 
Input
4 1
Output
1 2 3 4 
Input
5 6
Output
-1
----------------------------------------------------------------------------------------------------
E. Awards For Contestants
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 2 3 4
Output
3 3 2 1 
Input
6
1 4 3 1 1 2
Output
-1 1 2 -1 -1 3 
----------------------------------------------------------------------------------------------------
F. Forbidden Indices
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
ababa
00100
Output
5
Input
5
ababa
00000
Output
6
Input
5
ababa
11111
Output
0
----------------------------------------------------------------------------------------------------
