Codeforces Round 172 (Div. 1)


A. Rectangle Puzzle
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1 1 45
Output
0.828427125
Input
6 4 30
Output
19.668384925
----------------------------------------------------------------------------------------------------
B. Maximum Xor Secondary
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
5 2 1 4 3
Output
7
Input
5
9 8 3 5 7
Output
15
----------------------------------------------------------------------------------------------------
C. Game on Tree
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 2
Output
1.50000000000000000000
Input
3
1 2
1 3
Output
2.00000000000000000000
----------------------------------------------------------------------------------------------------
D. k-Maximum Subsequence Sum
time limit per test: 4 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
9
9 -8 9 -1 -1 -1 9 -8 9
3
1 1 9 1
1 1 9 2
1 4 6 3
Output
17
25
0
Input
15
-4 8 -3 -10 10 4 -7 -7 0 -6 3 8 -10 7 2
15
1 3 9 2
1 6 12 1
0 6 5
0 10 -7
1 4 9 1
1 7 9 1
0 10 -3
1 4 10 2
1 3 13 2
1 4 11 2
0 15 -9
0 13 -9
0 11 -10
1 5 14 2
1 6 12 1
Output
14
11
15
0
15
26
18
23
8
----------------------------------------------------------------------------------------------------
E. Sequence Transformation
time limit per test: 3 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 6 2 2
1 4 6
Output
1.666667 3.666667 5.666667 
0.666667
Input
10 100000 8714 9344
3378 14705 17588 22672 32405 34309 37446 51327 81228 94982
Output
1.000000 8715.000000 17429.000000 26143.000000 34857.000000 43571.000000 52285.000000 61629.000000 70973.000000 80317.000000 
797708674.000000
----------------------------------------------------------------------------------------------------
