Codeforces Beta Round 74 (Div. 1 Only)


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

Examples
Input
2 3 1
2 3
Output
0
Input
3 2 2
4 1 3
Output
2
----------------------------------------------------------------------------------------------------
B. Widget Library
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
12
Widget me(50,40)
VBox grandpa
HBox father
grandpa.pack(father)
father.pack(me)
grandpa.set_border(10)
grandpa.set_spacing(20)
Widget brother(30,60)
father.pack(brother)
Widget friend(20,60)
Widget uncle(100,20)
grandpa.pack(uncle)
Output
brother 30 60
father 80 60
friend 20 60
grandpa 120 120
me 50 40
uncle 100 20
Input
15
Widget pack(10,10)
HBox dummy
HBox x
VBox y
y.pack(dummy)
y.set_border(5)
y.set_spacing(55)
dummy.set_border(10)
dummy.set_spacing(20)
x.set_border(10)
x.set_spacing(10)
x.pack(pack)
x.pack(dummy)
x.pack(pack)
x.set_border(0)
Output
dummy 0 0
pack 10 10
x 40 10
y 10 10
----------------------------------------------------------------------------------------------------
C. Chip Play
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4
DRLD
U.UL
.UUR
RDDL
Output
10 1
Input
3 5
.D...
RRRLL
.U...
Output
6 2
----------------------------------------------------------------------------------------------------
D. Space mines
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 0 0 1 0 0 5
2
10 8 0 2 2
0 -3 0
2 2 0
20 0 0 4 3
2 4 0
-4 3 0
1 -5 0
Output
10.0000000000
Input
8 8 4 4 4 2 6
1
-2 -2 -1 3 0
Output
-1
Input
30 30 2 1 2 1 20
3
0 0 40 5 1
1 4 4
-10 -40 -5 7 0
100 200 95 8 1
-10 0 0
Output
74.6757620881
----------------------------------------------------------------------------------------------------
E. Fire and Ice
time limit per test: 0.5 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 0 1
Output
ARARARALLLA
Input
3
0 2 0
Output
ARARALAARALA
----------------------------------------------------------------------------------------------------
