Educational Codeforces Round 72 (Rated for Div. 2)


A. Creating a Character
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5 3 4
2 1 0
3 5 5
4 10 6
Output
3
1
2
0
----------------------------------------------------------------------------------------------------
B. Zmei Gorynich
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 10
6 3
8 2
1 4
4 10
4 1
3 2
2 6
1 100
2 15
10 11
14 100
Output
2
3
-1
----------------------------------------------------------------------------------------------------
C. The Number Of Good Substrings
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0110
0101
00001000
0001000
Output
4
3
4
3
----------------------------------------------------------------------------------------------------
D. Coloring Edges
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
1 2
1 3
3 4
2 4
1 4
Output
1
1 1 1 1 1 
Input
3 3
1 2
2 3
3 1
Output
2
1 1 2 
----------------------------------------------------------------------------------------------------
E. Sum Queries?
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
300 10001 20 20
2 1 3
1 1 310
2 1 3
2 3 3
2 3 4
Output
-1
330
-1
40
----------------------------------------------------------------------------------------------------
F. Forced Online Queries Problem
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 9
1 1 2
1 1 3
2 3 2
1 2 4
2 3 4
1 2 4
2 3 4
1 1 3
2 4 3
Output
1010
Input
3 9
1 1 2
1 2 3
1 3 1
2 1 3
1 3 2
2 2 3
1 1 2
2 1 2
2 1 2
Output
1101
----------------------------------------------------------------------------------------------------
