Codeforces Round 339 (Div. 2)


A. Link/Cut Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 10 2
Output
1 2 4 8 
Input
2 4 5
Output
-1
----------------------------------------------------------------------------------------------------
B. Gena's Code
time limit per test: 0.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
5 10 1
Output
50
Input
4
1 1 10 11
Output
110
Input
5
0 3 1 100 1
Output
0
----------------------------------------------------------------------------------------------------
C. Peter and Snow Blower
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 0 0
0 1
-1 2
1 2
Output
12.566370614359172464
Input
4 1 -1
0 0
1 2
2 0
1 1
Output
21.991148575128551812
----------------------------------------------------------------------------------------------------
D. Skills
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 5 10 1 5
1 3 1
Output
12
2 5 2 
Input
3 5 10 1 339
1 3 1
Output
35
5 5 5 
----------------------------------------------------------------------------------------------------
E. Necklace
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
4 2 1
Output
1
abacaba
Input
1
4
Output
4
aaaa
Input
2
1 1
Output
0
ab
----------------------------------------------------------------------------------------------------
