Codeforces Round 880 (Div. 2)


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

Examples
Input
5
6
0 1 2 0 1 0
9
0 0 0 0 1 1 1 2 2
3
0 0 2
1
99
5
0 1 2 3 4
Output
YES
YES
NO
NO
YES
----------------------------------------------------------------------------------------------------
B. Astrophysicists
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3 3 100
2 1 14
91 2 13
36 16 6
73 8 22
Output
100
0
26
72
176
----------------------------------------------------------------------------------------------------
C. k-th equality
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1 1 1 9
2 2 3 1
2 2 1 1
1 5 6 42
1 6 6 10000000
5 5 6 3031568815
6 6 6 1000000000000
Output
2 + 1 = 3
10 + 90 = 100
-1
9 + 99996 = 100005
-1
78506 + 28543 = 107049
-1
----------------------------------------------------------------------------------------------------
D. Lottery
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 6 2
1 4 5
Output
4 2
Input
7 7 1
2 4 7 3 0 1 6
Output
1 5
----------------------------------------------------------------------------------------------------
E. Twin Clusters
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2
4 15 0 7 11 8 3 2
1
0 1 2 3
0
0 0
3
15 63 57 39 61 25 42 61 50 41 27 41 56 23 17 27
Output
2 4 6 6
2 2 3 4
1 1 2 2
1 1 4 10
----------------------------------------------------------------------------------------------------
F. Doctor's Brown Hypothesis
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 8 346
1 2
1 3
2 4
3 4
4 5
5 1
6 7
7 6
Output
5
Input
5 6 128
1 2
1 3
2 4
3 4
4 5
5 1
Output
6
Input
3 3 30
1 2
2 3
3 2
Output
2
----------------------------------------------------------------------------------------------------
