Codeforces Round 469 (Div. 2)


A. Left-handers, Right-handers and Ambidexters
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 4 2
Output
6
Input
5 5 5
Output
14
Input
0 2 0
Output
0
----------------------------------------------------------------------------------------------------
B. Intercepted Message
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
7 6
2 5 3 1 11 4 4
7 8 2 4 1 8
Output
3
Input
3 3
1 10 100
1 100 10
Output
2
Input
1 4
4
1 1 1 1
Output
1
----------------------------------------------------------------------------------------------------
C. Zebras
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
0010100
Output
3
3 1 3 4
3 2 5 6
1 7
Input
111
Output
-1
----------------------------------------------------------------------------------------------------
D. A Leapfrog in the Array
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4 3
2
3
4
Output
3
2
4
Input
13 4
10
5
4
8
Output
13
3
8
9
----------------------------------------------------------------------------------------------------
E. Data Center Maintenance
time limit per test: 1 second
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3 3 5
4 4 0
1 3
3 2
3 1
Output
1
3 
Input
4 5 4
2 1 0 3
4 3
3 2
1 2
1 4
1 3
Output
4
1 2 3 4 
----------------------------------------------------------------------------------------------------
F. Curfew
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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