Codeforces Round 706 (Div. 2)


A. Split it!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
5 1
qwqwq
2 1
ab
3 1
ioi
4 2
icpc
22 0
dokidokiliteratureclub
19 8
imteamshanghaialice
6 3
aaaaaa
Output
YES
NO
YES
NO
YES
NO
NO
----------------------------------------------------------------------------------------------------
B. Max and Mex
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4 1
0 1 3 4
3 1
0 1 4
3 0
0 1 4
3 2
0 1 2
3 2
1 2 3
Output
4
4
3
5
3
----------------------------------------------------------------------------------------------------
C. Diamond Miner
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 0
0 -1
-2 0
4
1 0
3 0
-5 0
6 0
0 3
0 1
0 2
0 4
5
3 0
0 4
0 -3
4 0
2 0
1 0
-3 0
0 -10
0 -2
0 -10
Output
3.650281539872885
18.061819283610362
32.052255376143336
----------------------------------------------------------------------------------------------------
D. Let's Go Hiking
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 5 4 3
Output
1
Input
7
1 2 4 6 5 3 7
Output
0
----------------------------------------------------------------------------------------------------
E. Garden of the Sun
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3 3
X.X
...
X.X
4 4
....
.X.X
....
.X.X
5 5
.X...
....X
.X...
.....
X.X.X
1 10
....X.X.X.
2 2
..
..
Output
XXX
..X
XXX
XXXX
.X.X
.X..
.XXX
.X...
.XXXX
.X...
.X...
XXXXX
XXXXXXXXXX
..
..
----------------------------------------------------------------------------------------------------
F. BFS Trees
time limit per test: 2.5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4 4
1 2
2 3
3 4
1 4
Output
2 1 0 1
1 2 1 0
0 1 2 1
1 0 1 2
Input
8 9
1 2
1 3
1 4
2 7
3 5
3 6
4 8
2 3
3 4
Output
1 0 0 0 0 0 0 0
0 2 0 0 0 0 2 0
0 0 1 0 1 1 0 0
0 0 0 2 0 0 0 2
0 0 1 0 1 1 0 0
0 0 1 0 1 1 0 0
0 2 0 0 0 0 2 0
0 0 0 2 0 0 0 2
----------------------------------------------------------------------------------------------------
