Educational Codeforces Round 15


A. Maximum Increase
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
1 7 2 11 15
Output
3
Input
6
100 100 100 100 100 100
Output
1
Input
3
1 2 3
Output
3
----------------------------------------------------------------------------------------------------
B. Powers of Two
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
7 3 2 1
Output
2
Input
3
1 1 1
Output
3
----------------------------------------------------------------------------------------------------
C. Cellular Network
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
-2 2 4
-3 0
Output
4
Input
5 3
1 5 10 14 17
4 11 15
Output
3
----------------------------------------------------------------------------------------------------
D. Road to Post Office
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2 1 4 10
Output
14
Input
5 2 1 4 5
Output
13
----------------------------------------------------------------------------------------------------
E. Analysis of Pathes in Functional Graph
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
7 3
1 2 3 4 3 2 6
6 3 1 4 2 2 3
Output
10 1
8 1
7 1
10 2
8 2
7 1
9 3
Input
4 4
0 1 2 3
0 1 2 3
Output
0 0
4 1
8 2
12 3
Input
5 3
1 2 3 4 0
4 1 2 14 3
Output
7 1
17 1
19 2
21 3
8 1
----------------------------------------------------------------------------------------------------
F. T-Shirts
time limit per test: 4 seconds
memory limit per test: 1024 megabytes
input: standard input
output: standard output

Examples
Input
3
7 5
3 5
4 3
2
13 14
Output
2 3 
Input
2
100 500
50 499
4
50 200 150 100
Output
1 2 2 1 
----------------------------------------------------------------------------------------------------
