Zepto Code Rush 2014


A. Feed with Candy
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 3
0 2 4
1 3 1
0 8 3
0 20 10
1 5 5
Output
4
----------------------------------------------------------------------------------------------------
B. Om Nom and Spiders
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 4
...
R.L
R.U
Output
0 2 2 
Input
2 2 2
..
RL
Output
1 1 
Input
2 2 2
..
LR
Output
0 0 
Input
3 4 8
....
RRLL
UUUU
Output
1 3 3 1 
Input
2 2 2
..
UU
Output
0 0 
----------------------------------------------------------------------------------------------------
C. Dungeons and Candies
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3 3 2
A.A
...
A.a
..C
X.Y
...
Output
14
1 0
2 1
3 1
Input
1 1 4 1
A
.
B
.
Output
3
1 0
2 0
4 2
3 0
Input
1 3 5 2
ABA
BBB
BBA
BAB
ABB
Output
11
1 0
3 1
2 3
4 2
5 1
----------------------------------------------------------------------------------------------------
D. Pudding Monsters
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 3 5
2 4
Output
2
Input
4 2
1 3 4 6
2 5
Output
2
Input
4 2
1 8 4 5
7 2
Output
1
----------------------------------------------------------------------------------------------------
E. Cardboard Box
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 3
1 2
1 2
Output
3
12
Input
5 3
10 20
5 10
10 20
6 9
25 30
Output
14
01020
----------------------------------------------------------------------------------------------------
F. Banners
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2 1
2 0
0 2
Output
0 3
3 2
4 2
2 2
Input
3 1
3 1
2 2
1 3
Output
0 4
3 4
7 3
7 2
4 2
----------------------------------------------------------------------------------------------------
