Codeforces Round 860 (Div. 2)


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

Examples
Input
7
3
7 9 7
7 6 9
4
10 10 15 15
10 16 15 15
2
100 99
99 100
1
1
1
9
1 2 3 4 5 6 7 8 9
9 9 9 9 9 9 6 6 6
7
1 1 2 2 1 1 2
1 2 1 2 1 2 1
2
30 4
5 30
Output
Yes
No
Yes
Yes
Yes
No
No
----------------------------------------------------------------------------------------------------
B. Three Sevens
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
4
1 2 4 8
3
2 9 1
2
1 4
2
2
1 2
2
2 1
4
4
1 2 3 4
1
1
1
4
1
3
Output
8 2 1 
-1
2 1 4 3 
----------------------------------------------------------------------------------------------------
C. Candy Store
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4
20 3
6 2
14 5
20 7
3
444 5
2002 10
2020 2
5
7 7
6 5
15 2
10 3
7 7
5
10 1
11 5
5 1
2 2
8 2
6
7 12
12 3
5 3
9 12
9 3
1000000000 10000
Output
2
1
3
2
5
----------------------------------------------------------------------------------------------------
D. Shocking Arrangement
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
4
3 4 -2 -5
5
2 2 2 -3 -3
8
-3 -3 1 1 1 1 1 1
3
0 1 -1
7
-3 4 3 4 -4 -4 0
1
0
7
-18 13 -18 -17 12 15 13
Output
Yes
-5 -2 3 4
Yes
-3 2 -3 2 2
Yes
1 1 1 -3 1 1 1 -3
Yes
-1 0 1
Yes
4 -4 4 -4 0 3 -3
No
Yes
13 12 -18 15 -18 13 -17
----------------------------------------------------------------------------------------------------
E. Multitest Generator
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
1 2 1 7
7
3 1 3 1 2 1 1
4
2 7 1 1
Output
0 1 1 
0 1 1 0 1 1 
1 1 1 
Input
1
19
3 4 1 2 1 7 7 3 1 3 1 2 1 1 4 2 7 1 1
Output
0 0 1 1 1 1 1 1 1 0 1 0 1 0 2 1 1 1 
----------------------------------------------------------------------------------------------------
F. Gifts from Grandfather Ahmed
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

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