Educational Codeforces Round 120 (Rated for Div. 2)


A. Construct a Rectangle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
6 1 5
2 5 2
2 4 2
5 5 4
Output
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
B. Berland Music
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2
1 2
10
3
3 1 2
111
8
2 3 1 8 5 4 7 6
01110001
Output
2 1
3 1 2
1 6 5 8 3 2 4 7
----------------------------------------------------------------------------------------------------
C. Set or Decrease
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 10
20
2 69
6 9
7 8
1 2 1 3 1 2 1
10 1
1 2 3 1 2 6 1 6 8 10
Output
10
0
2
7
----------------------------------------------------------------------------------------------------
D. Shuffle
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
7 2
1100110
Output
16
Input
5 0
10010
Output
1
Input
8 1
10001000
Output
10
Input
10 8
0010011000
Output
1
----------------------------------------------------------------------------------------------------
E. Math Test
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 3
5 1 2 2
110
100
101
100
4 4
6 2 0 10
1001
0010
0110
0101
3 6
20 3 15
010110
000101
111111
Output
3 1 2 
2 3 4 1 
3 1 4 5 2 6 
----------------------------------------------------------------------------------------------------
F. Quadratic Set
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
1
1 
Input
4
Output
3
1 3 4 
Input
7
Output
4
1 4 5 6 
Input
9
Output
7
1 2 4 5 6 7 9 
----------------------------------------------------------------------------------------------------
