Educational Codeforces Round 106 (Rated for Div. 2)


A. Domino on Windowsill
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 0 1
1 0
1 1 1
0 0
3 0 0
1 3
4 3 1
2 2
5 4 3
3 1
Output
NO
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
B. Binary Removals
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
10101011011
0000
11111
110
1100
Output
YES
YES
YES
YES
NO
----------------------------------------------------------------------------------------------------
C. Minimum Grid Path
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2
13 88
3
2 3 1
5
4 3 2 1 4
Output
202
13
19
----------------------------------------------------------------------------------------------------
D. The Number of Pairs
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
1 1 3
4 2 6
3 3 7
2 7 25
Output
4
3
0
8
----------------------------------------------------------------------------------------------------
E. Chaotic Merge
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
aaa
bb
Output
24
Input
code
forces
Output
1574
Input
aaaaa
aaa
Output
0
Input
justamassivetesttocheck
howwellyouhandlemodulooperations
Output
667387032
----------------------------------------------------------------------------------------------------
F. Diameter Cuts
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
1 2
1 3
1 4
Output
8
Input
2 0
1 2
Output
1
Input
6 2
1 6
2 4
2 6
3 6
5 6
Output
25
Input
6 3
1 2
1 5
2 3
3 4
5 6
Output
29
----------------------------------------------------------------------------------------------------
G. Graph Coloring
time limit per test: 7 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
3 4 2
1 2
3 4
10
1 1 3
1 2 3
2
1 3 3
2
1 2 4
2
1 2 1
1 1 1
2
Output
8
8
1 3
40
2 3 5
104
3 5 6 3
104
360
4 5 6 3 8
----------------------------------------------------------------------------------------------------
