Codeforces Round 842 (Div. 2)


A. Greatest Convex
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
6
8
10
Output
2
5
7
9
----------------------------------------------------------------------------------------------------
B. Quick Sort
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3 2
1 2 3
3 1
3 1 2
4 2
1 3 2 4
4 2
2 3 1 4
Output
0
1
1
2
----------------------------------------------------------------------------------------------------
C. Elemental Decompress
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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

Examples
Input
4
2
2 1
2
1 2
4
3 4 1 2
4
2 4 3 1
Output
0
1
3
1
----------------------------------------------------------------------------------------------------
E. Partial Sorting
time limit per test: 1.5 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
1 100009067
Output
9
Input
2 100000357
Output
1689
Input
69 999900997
Output
193862705
----------------------------------------------------------------------------------------------------
F. Wonderful Jump
time limit per test: 4 seconds
memory limit per test: 128 megabytes
input: standard input
output: standard output

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