Coder-Strike 2014 - Round 2


A. Data Recovery
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1 1 2
1
Output
Correct
Input
3 1 1 3
2
Output
Correct
Input
2 1 1 3
2
Output
Incorrect
----------------------------------------------------------------------------------------------------
B. Spyke Chatting
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4 5
1 1 1 1
1 0 1 1
1 1 0 0
1 1
3 1
1 3
2 4
3 2
Output
3 3 1 
Input
4 3 4
0 1 1
1 0 1
1 1 1
0 0 0
1 2
2 1
3 1
1 3
Output
0 2 3 0 
----------------------------------------------------------------------------------------------------
C. Jeopardy!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 1
1 3 7 5
3
Output
18
Input
3 2
10 3 8
2 3
Output
40
Input
2 2
100 200
1 2
Output
400
----------------------------------------------------------------------------------------------------
D. 2048
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 4
2 2 4 2 2 2 2
Output
1
Input
1 3
0
Output
0
Input
2 3
0 4
Output
1
Input
5 4
2 0 0 4 4
Output
2
----------------------------------------------------------------------------------------------------
E. Maze 2D
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 7
.X..
...X
5 1
1 3
7 7
1 4
6 1
4 7
5 7
Output
1
4
0
5
2
2
2
Input
10 3
X...X..X..
..X...X..X
11 7
7 18
18 10
Output
9
-1
3
----------------------------------------------------------------------------------------------------
