Codeforces Round 807 (Div. 2)


A. Mark the Photographer
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3 6
1 3 9 10 12 16
3 1
2 5 2 2 2 5
1 2
8 6
Output
YES
NO
YES
----------------------------------------------------------------------------------------------------
B. Mark the Dust Sweeper
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
2 0 0
5
0 2 0 2 0
6
2 0 3 0 4 6
4
0 0 0 10
Output
3
5
11
0
----------------------------------------------------------------------------------------------------
C. Mark and His Unfinished Essay
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
4 3 3
mark
1 4
5 7
3 8
1
10
12
7 3 3
creamii
2 3
3 4
2 9
9
11
12
Output
m
a
r
e
a
r
----------------------------------------------------------------------------------------------------
D. Mark and Lightbulbs
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
0100
0010
4
1010
0100
5
01001
00011
6
000101
010011
Output
2
-1
-1
5
----------------------------------------------------------------------------------------------------
E. Mark and Professor Koro
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 4
2 2 2 4 5
2 3
5 3
4 1
1 4
Output
6
5
4
5
Input
2 1
200000 1
2 200000
Output
200001
----------------------------------------------------------------------------------------------------
F. Mark and the Online Exam
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1
3
Output
FTT
TTF
Input
4
0
3
4
Output
FTFF
TTTT
TFTT
----------------------------------------------------------------------------------------------------
