Codeforces Round 234 (Div. 2)


A. Inna and Choose Options
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
OXXXOXOOXOOX
OXOXOXOXOXOX
XXXXXXXXXXXX
OOOOOOOOOOOO
Output
3 1x12 2x6 4x3
4 1x12 2x6 3x4 6x2
6 1x12 2x6 3x4 4x3 6x2 12x1
0
----------------------------------------------------------------------------------------------------
B. Inna and New Matrix of Candies
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
*G*S
G**S
*G*S
Output
2
Input
1 3
S*G
Output
-1
----------------------------------------------------------------------------------------------------
C. Inna and Huge Candy Matrix
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 3 1 1 9
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
Output
1 3
1 2
1 1
2 3
2 2
2 1
3 3
3 2
3 1
----------------------------------------------------------------------------------------------------
D. Dima and Bacteria
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4 2
1 3
2 3 0
3 4 0
2 4 1
2 1 2
Output
Yes
0 2
2 0
Input
3 1 2
2 1
1 2 0
Output
Yes
0 -1
-1 0
Input
3 2 2
2 1
1 2 0
2 3 1
Output
Yes
0 1
1 0
Input
3 0 2
1 2
Output
No
----------------------------------------------------------------------------------------------------
E. Inna and Binary Logic
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4
1 1 1
1 1
2 2
3 2
1 2
Output
6
4
7
12
----------------------------------------------------------------------------------------------------
