Educational Codeforces Round 76 (Rated for Div. 2)


A. Two Rival Students
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 1 3 2
100 33 100 1
6 0 2 3
Output
2
99
1
----------------------------------------------------------------------------------------------------
B. Magic Stick
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
2 3
1 1
3 6
6 8
1 2
4 1
31235 6578234
Output
YES
YES
NO
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
C. Dominated Subarray
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1
1
6
1 2 3 4 5 1
9
4 1 2 4 5 4 3 2 1
4
3 3 3 3
Output
-1
6
3
2
----------------------------------------------------------------------------------------------------
D. Yet Another Monster Killing Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
6
2 3 11 14 1 8
2
3 2
100 1
5
3 5 100 2 3
2
30 5
90 1
Output
5
-1
----------------------------------------------------------------------------------------------------
E. The Contest
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
2 1 2
3 1
4
2 5
Output
1
Input
3 2 1
3 2 1
5 4
6
Output
0
Input
2 1 3
5 6
4
1 2 3
Output
3
Input
1 5 1
6
5 1 2 4 7
3
Output
2
----------------------------------------------------------------------------------------------------
F. Make Them Similar
time limit per test: 4 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
2
7 2
Output
1
Input
4
3 17 6 0
Output
5
Input
3
1 2 3
Output
-1
Input
3
43 12 12
Output
1073709057
----------------------------------------------------------------------------------------------------
G. Divisor Set
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
2999999 43 2999957
Output
3
Input
6
2 3 2 3 2 2
Output
3
----------------------------------------------------------------------------------------------------
