Codeforces Round 125 (Div. 1)


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

Examples
Input
3 1 3 5
Output
2
Input
1 4 4 7
Output
3
Input
2 2 4 100
Output
0
----------------------------------------------------------------------------------------------------
B. Jumping on Walls
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 3
---X--X
-X--XX-
Output
YES
Input
6 2
--X-X-
X--XX-
Output
NO
----------------------------------------------------------------------------------------------------
C. Delivering Carcinogen
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
10 0 1
-10 0 2 8
Output
9.584544103
Input
50 60 10
50 60 20 40
Output
0.000000000
----------------------------------------------------------------------------------------------------
D. Cube Snake
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
Output
1 4 17 
2 3 18 
27 26 19 
8 5 16 
7 6 15 
24 25 20 
9 12 13 
10 11 14 
23 22 21 
----------------------------------------------------------------------------------------------------
E. Gripping Story
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
0 0 5 10 5
5 4 7 11 5
-7 1 4 7 8
0 2 13 5 6
2 -3 9 3 4
13 5 1 9 9
Output
3
----------------------------------------------------------------------------------------------------
