Educational Codeforces Round 69 (Rated for Div. 2)


A. DIY Wooden Ladder
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
4
1 3 1 3
3
3 3 2
5
2 3 3 4 2
3
1 1 2
Output
2
1
2
0
----------------------------------------------------------------------------------------------------
B. Pillars
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
1 3 4 2
Output
YES
Input
3
3 1 2
Output
NO
----------------------------------------------------------------------------------------------------
C. Array Splitting
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 3
4 8 15 16 23 42
Output
12
Input
4 4
1 3 3 7
Output
0
Input
8 1
1 1 2 3 5 8 13 21
Output
20
----------------------------------------------------------------------------------------------------
D. Yet Another Subarray Problem
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 3 10
2 -4 15 -3 4 8 3
Output
7
Input
5 2 1000
-13 -4 -9 -20 -11
Output
0
----------------------------------------------------------------------------------------------------
E. Culture Code
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7
4 1
4 2
4 2
2 1
5 4
6 4
3 2
Output
6
----------------------------------------------------------------------------------------------------
F. Coloring Game
time limit per test: 5 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
3
3 4 5
2
1 1 1
2 2 2
1 1 1
1 0 0
0 1 1
Output
14346
Input
1
1
1
1 1 1
1 1 1
1 1 1
1 1 1
Output
1
Input
3
1 1 1
1
1 1 1
1 1 1
1 1 1
1 1 1
Output
9
----------------------------------------------------------------------------------------------------
