Codeforces Round 327 (Div. 2)


A. Wizards' Duel
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
100
50
50
Output
50
Input
199
60
40
Output
119.4
----------------------------------------------------------------------------------------------------
B. Rebranding
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 1
police
p m
Output
molice
Input
11 6
abacabadaba
a b
b c
a d
e g
f a
b b
Output
cdcbcdcfcdc
----------------------------------------------------------------------------------------------------
C. Median Smoothing
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0 1 1
Output
0
0 0 1 1
Input
5
0 1 0 1 0
Output
2
0 0 0 0 0
----------------------------------------------------------------------------------------------------
D. Chip 'n Dale Rescue Rangers
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
0 0 5 5
3 2
-1 -1
-1 0
Output
3.729935587093555327
Input
0 0 0 1000
100 1000
-50 0
50 0
Output
11.547005383792516398
----------------------------------------------------------------------------------------------------
E. Three States
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4 5
11..2
#..22
#.323
.#333
Output
2
Input
1 5
1#2#3
Output
-1
----------------------------------------------------------------------------------------------------
