Educational Codeforces Round 18


A. New Bus Route
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
6 -3 0 4
Output
2 1
Input
3
-2 0 2
Output
2 2
----------------------------------------------------------------------------------------------------
B. Counting-out Rhyme
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
7 5
10 4 11 4 1
Output
4 2 5 6 1 
Input
3 2
2 5
Output
3 2 
----------------------------------------------------------------------------------------------------
C. Divide by Three
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1033
Output
33
Input
10
Output
0
Input
11
Output
-1
----------------------------------------------------------------------------------------------------
D. Paths in a Complete Binary Tree
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
15 2
4
UURL
8
LRLLLLLLLL
Output
10
5
----------------------------------------------------------------------------------------------------
E. Colored Balls
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 7 8
Output
5
Input
2
2 7
Output
4
----------------------------------------------------------------------------------------------------
F. Mages and Monsters
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 100
1 4 9
2 19 49
2 19 49
Output
YES
NO
----------------------------------------------------------------------------------------------------
