Codeforces Round 335 (Div. 2)


A. Magic Spheres
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 4 0
2 1 2
Output
Yes
Input
5 6 1
2 7 2
Output
No
Input
3 3 3
2 2 2
Output
Yes
----------------------------------------------------------------------------------------------------
B. Testing Robots
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 4 2 2
UURDRDRL
Output
1 1 0 1 1 1 1 0 6
Input
2 2 2 2
ULD
Output
1 1 1 1
----------------------------------------------------------------------------------------------------
C. 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
----------------------------------------------------------------------------------------------------
D. 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
----------------------------------------------------------------------------------------------------
E. 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
----------------------------------------------------------------------------------------------------
