Codeforces Round 335 (Div. 1)


A. Sorting Railway Cars
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5
4 1 2 5 3
Output
2
Input
4
4 1 3 2
Output
2
----------------------------------------------------------------------------------------------------
B. Lazy Student
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 5
2 1
3 1
4 0
1 1
5 0
Output
2 4
1 4
3 4
3 1
3 2
Input
3 3
1 0
2 1
3 1
Output
-1
----------------------------------------------------------------------------------------------------
C. Freelancer's Dreams
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 20 20
6 2
1 3
2 6
Output
5.000000000000000
Input
4 1 1
2 3
3 2
2 3
3 2
Output
0.400000000000000
----------------------------------------------------------------------------------------------------
D. Board Game
time limit per test: 2.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0 3 4
2 2 5 3
4 1 1 7
5 3 8 8
Output
3
1 2 4
Input
2
0 0 4 6
5 1 1000000000 1000000000
Output
-1
----------------------------------------------------------------------------------------------------
E. Intergalaxy Trips
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
100 50 50
0 100 80
0 0 100
Output
1.750000000000000
Input
2
100 30
40 100
Output
3.333333333333333
----------------------------------------------------------------------------------------------------
