Codeforces Round 679 (Div. 1, based on Technocup 2021 Elimination Round 1)


A. Perform Easily
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 4 100 10 30 5
6
101 104 105 110 130 200
Output
0
Input
1 1 2 2 3 3
7
13 4 11 12 11 13 12
Output
7
----------------------------------------------------------------------------------------------------
B. Shurikens
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
+
+
- 2
+
- 3
+
- 1
- 4
Output
YES
4 2 3 1 
Input
1
- 1
+
Output
NO
Input
3
+
+
+
- 2
- 1
- 3
Output
NO
----------------------------------------------------------------------------------------------------
C. Solo mid Oracle
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
1 1 1 1
2 2 2 2
1 2 3 4
4 3 2 1
228 21 11 3
239 21 11 3
1000000 1 1000000 1
Output
1
2
1
5
534
-1
500000500000
----------------------------------------------------------------------------------------------------
D. Roads and Ramen
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
5
1 2 0
1 3 0
3 5 0
3 4 0
5
3
4
1
3
4
Output
3
2
3
3
2
----------------------------------------------------------------------------------------------------
E. A Convex Game
time limit per test: 3 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
1
10
1 2 3 4 5 6 7 8 9 10
Output
YES
Input
2
10
1 2 3 4 5 6 7 8 9 10
10
1 2 3 4 5 6 7 8 9 10
Output
NO
Input
4
7
14404 32906 41661 47694 51605 75933 80826
5
25374 42550 60164 62649 86273
2
7002 36731
8
23305 45601 46404 47346 47675 58125 74092 87225
Output
NO
----------------------------------------------------------------------------------------------------
