Codeforces Round 755 (Div. 1, based on Technocup 2022 Elimination Round 2)


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

Examples
Input
3
3
-1 1 0
0 0 2
1
0
2
5
1 2 3 4 5
1 2 3 4 5
Output
YES
NO
YES
----------------------------------------------------------------------------------------------------
B. Guess the Permutation
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 
5 
4 
3 
3 
5 
2 
2 
1 
Output
? 1 5
? 2 5
? 3 5
! 1 3 5
? 1 5
? 2 5
? 3 5
! 2 4 5
----------------------------------------------------------------------------------------------------
C. Game with Stones
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
2
2 2
3
1 2 3
4
1 1 1 1
4
1 2 2 1
4
1 2 1 2
8
1 2 1 2 1 2 1 2
Output
1
0
4
2
1
3
----------------------------------------------------------------------------------------------------
D. Strange LCS
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
2
ABC
CBA
2
bacab
defed
3
abcde
aBcDe
ace
2
codeforces
technocup
Output
1
A
0
3
ace
3
coc
----------------------------------------------------------------------------------------------------
E. Eligible Segments
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 2
0 1
0 -1
3 0
-3 0
Output
1
Input
3 3
1 -1
-1 -1
0 1
Output
3
----------------------------------------------------------------------------------------------------
F. Jumping Through the Array
time limit per test: 8 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
6 9 -5 3 0
2 3 1 5 4
6
1 1 5
2 1 1
1 1 5
3 1 5
2 1 -1
1 1 5
Output
13
16
11
Input
8
-15 52 -4 3 5 9 0 5
2 4 6 8 1 3 5 7
10
2 2 2
2 5 -1
1 1 8
1 1 5
1 5 8
3 1 6
2 1 50
1 1 8
2 6 -20
1 1 8
Output
61
45
22
461
301
Input
1
1
1
1
1 1 1
Output
1
----------------------------------------------------------------------------------------------------
