Codeforces Round 859 (Div. 4)


A. Plus or Minus
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
11
1 2 3
3 2 1
2 9 -7
3 4 7
1 1 2
1 1 0
3 3 6
9 9 18
9 9 0
1 9 -8
1 9 10
Output
+
-
-
+
+
-
+
+
-
-
+
----------------------------------------------------------------------------------------------------
B. Grab the Candies
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4
1 2 3 4
4
1 1 1 2
3
1 4 3
Output
YES
NO
NO
----------------------------------------------------------------------------------------------------
C. Find and Replace
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
7
abacaba
2
aa
1
y
4
bkpt
6
ninfia
6
banana
10
codeforces
8
testcase
Output
YES
NO
YES
YES
NO
YES
NO
NO
----------------------------------------------------------------------------------------------------
D. Odd Queries
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5 5
2 2 1 3 2
2 3 3
2 3 4
1 5 5
1 4 9
2 4 3
10 5
1 1 1 1 1 1 1 1 1 1
3 8 13
2 5 10
3 8 10
1 10 2
1 9 100
Output
YES
YES
YES
NO
YES
NO
NO
NO
NO
YES
----------------------------------------------------------------------------------------------------
E. Interview
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
5
1 2 3 4 5
11
6
3
7
1 2 3 5 3 4 2
12
6
Output
? 4 1 2 3 4
? 2 2 3
? 1 2
! 2
? 4 2 3 5 6
? 2 1 4
! 7
----------------------------------------------------------------------------------------------------
F. Bouncy Ball
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
5 7 1 7 2 4 DL
5 7 1 7 3 2 DL
3 3 1 3 2 2 UR
2 4 2 1 2 2 DR
4 3 1 1 1 3 UL
6 4 1 2 3 4 DR
Output
3
-1
1
-1
4
0
----------------------------------------------------------------------------------------------------
G1. Subsequence Addition (Easy Version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1
1
1
2
5
5 1 3 2 1
5
7 1 5 2 1
3
1 1 1
5
1 1 4 2 1
Output
YES
NO
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
G2. Subsequence Addition (Hard Version)
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
1
1
1
2
5
5 1 3 2 1
5
7 1 5 2 1
3
1 1 1
5
1 1 4 2 1
Output
YES
NO
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
