Educational Codeforces Round 93 (Rated for Div. 2)


A. Bad Triangle
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
7
4 6 11 11 15 18 20
4
10 10 10 11
3
1 1 1000000000
Output
2 3 6
-1
1 2 3
----------------------------------------------------------------------------------------------------
B. Substring Removal Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
01111001
0000
111111
101010101
011011110111
Output
4
0
6
3
6
----------------------------------------------------------------------------------------------------
C. Good Subarrays
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
120
5
11011
6
600005
Output
3
6
1
----------------------------------------------------------------------------------------------------
D. Colored Rectangles
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 1
3
5
4
Output
20
Input
2 1 3
9 5
1
2 8 5
Output
99
Input
10 1 1
11 7 20 15 19 14 2 4 13 14
8
11
Output
372
----------------------------------------------------------------------------------------------------
E. Two Types of Spells
time limit per test: 3.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1 5
0 10
1 -5
0 5
1 11
0 -10
Output
5
25
10
15
36
21
----------------------------------------------------------------------------------------------------
F. Controversial Rounds
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
11?000
Output
6 3 2 1 0 0 
Input
5
01?01
Output
5 1 0 0 0 
Input
12
???1??????1?
Output
12 6 4 3 2 2 1 1 1 1 1 1 
----------------------------------------------------------------------------------------------------
G. Running Competition
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 10 5
0 3 5 10
6
24 30 14 16 18 10
Output
24 30 14 16 -1 -1 
----------------------------------------------------------------------------------------------------
