Codeforces Round 493 (Div. 2)


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

Examples
Input
3
1 2 1
Output
2
1 2
Input
2
5 5
Output
-1
Input
1
10
Output
-1
----------------------------------------------------------------------------------------------------
B. Cutting
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 4
1 2 5 10 15 20
Output
1
Input
4 10
1 3 2 4
Output
0
Input
6 100
1 2 3 4 5 6
Output
2
----------------------------------------------------------------------------------------------------
C. Convert to Ones
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 1 10
01000
Output
11
Input
5 10 1
01000
Output
2
Input
7 2 3
1111111
Output
0
----------------------------------------------------------------------------------------------------
D. Roman Digits
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
4
Input
2
Output
10
Input
10
Output
244
----------------------------------------------------------------------------------------------------
E. Sky Full of Stars
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
Output
3
Input
2
Output
63
Input
3
Output
9933
----------------------------------------------------------------------------------------------------
