Educational Codeforces Round 90 (Rated for Div. 2)


A. Donut Shops
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
5 10 4
4 5 20
2 2 3
1000000000 1000000000 1000000000
Output
-1 20
8 -1
1 2
-1 1000000000
----------------------------------------------------------------------------------------------------
B. 01 Game
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
01
1111
0011
Output
DA
NET
NET
----------------------------------------------------------------------------------------------------
C. Pluses and Minuses
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
--+-
---
++--+-
Output
7
9
6
----------------------------------------------------------------------------------------------------
D. Maximum Sum on Even Positions
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
8
1 7 3 4 7 6 2 9
5
1 2 1 2 1
10
7 8 4 5 7 6 8 9 7 3
4
3 1 2 1
Output
26
5
37
5
----------------------------------------------------------------------------------------------------
E. Sum of Digits
time limit per test: 2 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
7
1 0
1 1
42 7
13 7
99 1
99 0
99 2
Output
1
0
4
-1
599998
99999999999
7997
----------------------------------------------------------------------------------------------------
F. Network Coverage
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
3
2 3 4
3 3 3
3
3 3 3
2 3 4
4
2 3 4 5
3 7 2 2
4
4 5 2 3
2 3 2 7
2
1 1
10 10
Output
YES
YES
NO
YES
YES
----------------------------------------------------------------------------------------------------
G. Pawns
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

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