Educational Codeforces Round 19


A. k-Factorization
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
100000 2
Output
2 50000 
Input
100000 20
Output
-1
Input
1024 5
Output
2 64 2 2 2 
----------------------------------------------------------------------------------------------------
B. Odd sum
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
-2 2 -3 1
Output
3
Input
3
2 -5 -3
Output
-1
----------------------------------------------------------------------------------------------------
C. Minimal string
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
cab
Output
abc
Input
acdb
Output
abdc
----------------------------------------------------------------------------------------------------
D. Broken BST
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
15 -1 -1
10 1 3
5 -1 -1
Output
2
Input
8
6 2 3
3 4 5
12 6 7
1 -1 8
4 -1 -1
5 -1 -1
14 -1 -1
2 -1 -1
Output
1
----------------------------------------------------------------------------------------------------
E. Array Queries
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 1 1
3
1 1
2 1
3 1
Output
2
1
1
----------------------------------------------------------------------------------------------------
F. Mice and Holes
time limit per test: 1.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
6 2 8 9
3 6
2 1
3 6
4 7
4 7
Output
11
Input
7 2
10 20 30 40 50 45 35
-1000000000 10
1000000000 1
Output
7000000130
----------------------------------------------------------------------------------------------------
