Codeforces Round 517 (Div. 1, based on Technocup 2019 Elimination Round 2)


A. Cram Time
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
Output
1
3 
2
2 1 
Input
9 12
Output
2
3 6
4
1 2 4 5
----------------------------------------------------------------------------------------------------
B. Minimum path
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
abcd
bcde
bcad
bcde
Output
aaabcde
Input
5 3
bwwwz
hrhdh
sepsp
sqfaf
ajbvw
Output
aaaepfafw
Input
7 6
ypnxnnp
pnxonpm
nxanpou
xnnpmud
nhtdudu
npmuduh
pmutsnz
Output
aaaaaaadudsnz
----------------------------------------------------------------------------------------------------
C. Triple Flips
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 1 0 1 1
Output
YES
2
1 3 5
2 3 4
Input
3
0 1 0
Output
NO
----------------------------------------------------------------------------------------------------
D. Familiar Operations
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
9 10
100 17
220 70
17 19
4 18
32 20
100 32
224 385
Output
1
3
1
0
1
0
1
1
----------------------------------------------------------------------------------------------------
E. Rain Protection
time limit per test: 7 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 5 5
0 0
1 1 4
2 2 4
3 3 4
Output
1.0000000019
Input
2 5 5
0 0
2 4 1
3 1 4
Output
2.1428571437
Input
3 5 5
0 0
1 2 1
1 3 3
1 4 2
Output
-1
----------------------------------------------------------------------------------------------------
