Codeforces Round 237 (Div. 2)


A. Valera and X
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
xooox
oxoxo
soxoo
oxoxo
xooox
Output
NO
Input
3
wsw
sws
wsw
Output
YES
Input
3
xpx
pxp
xpe
Output
NO
----------------------------------------------------------------------------------------------------
B. Marathon
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 5
2
Output
1.0000000000 2.0000000000
2.0000000000 0.0000000000
Input
4.147 2.8819
6
Output
2.8819000000 0.0000000000
4.1470000000 1.6168000000
3.7953000000 4.1470000000
0.9134000000 4.1470000000
0.0000000000 2.1785000000
0.7034000000 0.0000000000
----------------------------------------------------------------------------------------------------
C. Restore Graph
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
0 1 1
Output
3
1 2
1 3
3 2
Input
4 2
2 0 1 3
Output
3
1 3
1 4
2 3
Input
3 1
0 0 0
Output
-1
----------------------------------------------------------------------------------------------------
D. Minesweeper 1D
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
?01???
Output
4
Input
?
Output
2
Input
**12
Output
0
Input
1
Output
0
----------------------------------------------------------------------------------------------------
E. Maze 1D
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
RR
Output
1
Input
RRL
Output
1
----------------------------------------------------------------------------------------------------
