Educational Codeforces Round 122 (Rated for Div. 2)


A. Div. 7
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
42
23
377
Output
42
28
777
----------------------------------------------------------------------------------------------------
B. Minority
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
01
1010101010111
00110001000
1
Output
0
5
3
0
----------------------------------------------------------------------------------------------------
C. Kill the Monster
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
25 4
9 20
1 1 10
25 4
12 20
1 1 10
100 1
45 2
0 4 10
9 2
69 2
4 2 7
Output
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
D. Make Them Equal
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4 4
1 7 5 2
2 6 5 2
3 0
3 5 2
5 4 7
5 9
5 2 5 6 3
5 9 1 9 7
6 14
11 4 6 2 8 16
43 45 9 41 15 38
Output
9
0
30
167
----------------------------------------------------------------------------------------------------
E. Spanning Tree Queries
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 8
4 1 4
3 1 0
3 5 3
2 5 4
3 4 8
4 3 4
4 2 8
5 3 9
3 11 1 1 10
0 1 2
Output
4
Input
6 7
2 4 0
5 4 7
2 4 0
2 1 7
2 6 1
3 4 4
1 4 8
4 10 3 3 7
3 0 2 1
Output
5
Input
3 3
1 2 50
2 3 100
1 3 150
1 10000000 0 0 100000000
75
Output
164
----------------------------------------------------------------------------------------------------
F. Perfect Matching
time limit per test: 12 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
6
1 4
6 1
3 2
1 2
5 1
1 4
2
1 2
2
1 3
2
1 5
1 6
2
3
Output
1
1 1
0
0
4
2 1 3
0
0
0
----------------------------------------------------------------------------------------------------
