Croc Champ 2012 - Final


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

Examples
Input
3
UR
UL
ULDR
Output
9
Input
2
DR
DL
Output
4
----------------------------------------------------------------------------------------------------
B. Zoo
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 5
2 1
4 1
3 2
4 3
4 4
Output
11
----------------------------------------------------------------------------------------------------
C. Cyclic Coloring
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4
1 2
2 1
3 4
4 3
Output
2
Input
5 2
1 4
2 5
Output
5
Input
4 5
1 2
2 3
3 1
2 4
4 1
Output
3
Input
4 4
1 1
1 2
2 1
1 2
Output
1
----------------------------------------------------------------------------------------------------
D. T-shirt
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2
500 500
500 500
Output
1.500000000000
Input
3 3
1000 0 0
1000 0 0
0 1000 0
Output
3.000000000000
Input
1 4
100 200 300 400
Output
0.400000000000
----------------------------------------------------------------------------------------------------
E. Candy Shop
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 5
5
10
Output
13
Input
3 8
8
16
13
Output
32
Input
2 5000000
12500002500000
12500002500000
Output
12500002500000
----------------------------------------------------------------------------------------------------
