Codeforces Round 514 (Div. 2)


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

Examples
Input
2 11 3
0 1
1 1
Output
3
Input
0 5 2
Output
2
Input
1 3 2
1 2
Output
0
----------------------------------------------------------------------------------------------------
B. Forgery
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
3
Output
1 1 3 
Input
2
Output
1 2 
Input
1
Output
1 
----------------------------------------------------------------------------------------------------
D. Nature Reserve
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
0 1
Output
0.5
Input
3
0 1
0 2
0 -3
Output
-1
Input
2
0 1
1 1
Output
0.625
----------------------------------------------------------------------------------------------------
E. Split the Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 1 3
1 2 3
1 1
Output
3
Input
3 3 6
1 2 3
1 1
Output
2
Input
1 1 10000
10001
Output
-1
----------------------------------------------------------------------------------------------------
