Educational Codeforces Round 152 (Rated for Div. 2)


A. Morning Sandwich
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 1 1
10 1 2
3 7 8
Output
3
7
5
----------------------------------------------------------------------------------------------------
B. Monsters
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 2
1 2 3
2 3
1 1
4 3
2 8 3 5
Output
2 1 3 
1 2 
3 1 2 4 
----------------------------------------------------------------------------------------------------
C. Binary String Copying
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
6 5
101100
1 2
1 3
2 4
5 5
1 6
6 4
100111
2 2
1 4
1 3
1 2
1 1
0
1 1
Output
3
3
1
----------------------------------------------------------------------------------------------------
D. Array Painting
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 2 0
Output
1
Input
4
0 0 1 1
Output
2
Input
7
0 1 0 0 1 0 2
Output
4
----------------------------------------------------------------------------------------------------
E. Max to the Right of Min
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2 3
Output
3
Input
6
5 3 6 1 4 2
Output
4
Input
10
5 1 6 2 8 3 4 10 9 7
Output
38
----------------------------------------------------------------------------------------------------
F. XOR Partition
time limit per test: 7 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
42 13 1337 37 152
Output
10001
Input
4
1 2 3 4
Output
1100
Input
2
1 2
Output
10
Input
8
7 6 5 4 3 2 1 0
Output
10010110
----------------------------------------------------------------------------------------------------
