Codeforces Round 797 (Div. 3)


A. Print a Pedestal (Codeforces logo?)
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
11
6
10
100000
7
8
Output
4 5 2
2 3 1
4 5 1
33334 33335 33331
2 4 1
3 4 1
----------------------------------------------------------------------------------------------------
B. Array Decrements
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
4
3 5 4 1
1 3 2 0
3
1 2 1
0 1 0
4
5 3 7 2
1 1 1 1
5
1 2 3 4 5
1 2 3 4 6
1
8
0
1
4
6
Output
YES
YES
NO
NO
YES
NO
----------------------------------------------------------------------------------------------------
C. Restoring the Duration of Tasks
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
3
0 3 7
2 10 11
2
10 15
11 16
9
12 16 90 195 1456 1569 3001 5237 19275
13 199 200 260 9100 10000 10914 91066 5735533
1
0
1000000000
Output
2 7 1 
1 1 
1 183 1 60 7644 900 914 80152 5644467 
1000000000 
----------------------------------------------------------------------------------------------------
D. Black and White Stripe
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5 3
BBWBW
5 5
BBWBW
5 1
BBWBW
1 1
W
Output
1
2
0
1
----------------------------------------------------------------------------------------------------
E. Price Maximization
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6
6 3
3 2 7 1 4 8
4 3
2 1 5 6
4 12
0 0 0 0
2 1
1 1
6 10
2 0 0 5 9 4
6 5
5 3 8 6 3 2
Output
8
4
0
2
1
5
----------------------------------------------------------------------------------------------------
F. Shifting String
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5
ababa
3 4 5 2 1
5
ababa
2 1 4 5 3
10
codeforces
8 6 1 7 5 2 9 3 10 4
Output
1
6
12
----------------------------------------------------------------------------------------------------
G. Count the Trains
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 2
6 2 3 7
3 2
4 7
5 4
10 13 5 2 6
2 4
5 2
1 5
3 2
13 4
769 514 336 173 181 373 519 338 985 709 729 702 168
12 581
6 222
7 233
5 117
Output
3 4 
4 4 2 3 
5 6 6 5 
----------------------------------------------------------------------------------------------------
