Codeforces Beta Round 36


A. Extra-terrestrial Intelligence
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: input.txt
output: output.txt

Examples
Input
8
00111000
Output
YES
Input
7
1001011
Output
NO
Input
7
1010100
Output
YES
----------------------------------------------------------------------------------------------------
B. Fractal
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: input.txt
output: output.txt

Examples
Input
2 3
.*
..
Output
.*******
..******
.*.*****
....****
.***.***
..**..**
.*.*.*.*
........
Input
3 2
.*.
***
.*.
Output
.*.***.*.
*********
.*.***.*.
*********
*********
*********
.*.***.*.
*********
.*.***.*.
----------------------------------------------------------------------------------------------------
C. Bowls
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: input.txt
output: output.txt

Examples
Input
2
40 10 50
60 20 30
Output
70.00000000
Input
3
50 30 80
35 25 70
40 10 90
Output
55.00000000
----------------------------------------------------------------------------------------------------
D. New Game with a Chess Piece
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: input.txt
output: output.txt

Examples
Input
10 2
1 1
1 2
2 1
2 2
1 3
2 3
3 1
3 2
3 3
4 3
Output
-
+
+
-
-
+
-
+
+
+
----------------------------------------------------------------------------------------------------
E. Two Paths
time limit per test: 2 seconds
memory limit per test: 64 megabytes
input: input.txt
output: output.txt

Examples
Input
2
4 5
4 3
Output
1
2 
1
1
Input
1
1 2
Output
-1
----------------------------------------------------------------------------------------------------
