Codeforces Round 882 (Div. 2)


A. The Man who became a God
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 2
1 3 5 2
6 3
1 9 12 4 7 2
12 8
1 9 8 2 3 3 1 8 7 7 9 2
Output
4
11
2
----------------------------------------------------------------------------------------------------
B. Hamon Odyssey
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
3
1 2 3
5
2 3 1 5 2
4
5 7 12 6
Output
1
2
1
----------------------------------------------------------------------------------------------------
C. Vampiric Powers, anyone?
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
0 2 5 1
3
1 2 3
5
8 2 4 12 1
Output
7
3
14
----------------------------------------------------------------------------------------------------
D. Professor Higashikata
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 2 4
01
1 2
1 2
1
1
2
2
Output
0
1
0
1
Input
8 6 10
10011010
5 6
2 3
6 8
5 7
5 8
6 8
3
5
6
2
5
2
5
8
4
1
Output
2
3
2
2
1
2
2
2
2
2
----------------------------------------------------------------------------------------------------
E. Triangle Platinum?
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
63
Output
? 1 2 3
! -1
Input
6
0
0
0
63
15
135
Output
? 1 2 3
? 2 3 4
? 4 5 6
? 1 5 6
? 3 5 6
? 1 2 4
! 3 2 1 4 2 2
Input
15
3
3
3
3
3
0
Output
? 1 2 3
? 4 6 7
? 8 9 10
? 11 12 13
? 13 14 15
? 4 5 6
! -1
Input
15
3
15
0
3
3
3
Output
? 1 2 3
? 3 4 5
? 4 5 6
? 7 8 9
? 10 11 12
? 13 14 15
! 1 1 1 2 2 4 1 1 1 1 1 1 1 1 1 1
Input
10
3
48
3
48
63
0
Output
? 1 3 5
? 4 6 8
? 1 5 9
? 6 8 10
? 4 2 6
? 7 10 8
! 1 3 1 2 1 2 4 2 1 2
----------------------------------------------------------------------------------------------------
F. The Boss's Identity
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

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