Croc Champ 2013 - Round 2 (Div. 2 Edition)


A. Ksusha and Array
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 2 4
Output
2
Input
5
2 1 3 1 6
Output
1
Input
3
2 3 5
Output
-1
----------------------------------------------------------------------------------------------------
B. Ksusha the Squirrel
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1
..
Output
YES
Input
5 2
.#.#.
Output
YES
Input
7 3
.#.###.
Output
NO
----------------------------------------------------------------------------------------------------
C. Weird Game
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
0111
0001
Output
First
Input
3
110110
001001
Output
First
Input
3
111000
000111
Output
Draw
Input
4
01010110
00101101
Output
First
Input
4
01100000
10010011
Output
Second
----------------------------------------------------------------------------------------------------
D. Distinct Paths
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 4
0 0
0 0
Output
48
Input
2 2 4
1 2
2 1
Output
0
Input
5 6 10
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
Output
3628800
Input
2 6 10
1 2 3 4 5 6
0 0 0 0 0 0
Output
4096
----------------------------------------------------------------------------------------------------
E. Cube Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
24
Output
1
Input
648
Output
7
Input
5
Output
0
Input
93163582512000
Output
39090
----------------------------------------------------------------------------------------------------
