Codeforces Beta Round 83 (Div. 1 Only)


A. Dorm Water Supply
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1 2 10
2 3 20
Output
1
1 3 10
Input
3 3
1 2 20
2 3 10
3 1 5
Output
0
Input
4 2
1 2 60
3 4 50
Output
2
1 2 60
3 4 50
----------------------------------------------------------------------------------------------------
B. Basketball Team
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2 1
2 1
Output
1
Input
3 2 1
1 1
Output
-1
Input
3 2 1
2 2
Output
0.666667
----------------------------------------------------------------------------------------------------
C. Arrangement
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2001 2
1 2
2 3
Output
1 2 3
Input
7 2020 6
1 2
1 3
2 4
2 5
3 6
3 7
Output
1 2 3 7 4 6 5
Input
10 3630801 0
Output
The times have changed
Input
3 2001 3
1 2
2 3
3 1
Output
The times have changed
----------------------------------------------------------------------------------------------------
D. Crime Management
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
5 2
A 1
B 2
Output
16
Input
6 3
A 1
B 2
C 3
Output
113
Input
8 3
A 2
A 3
B 2
Output
128
----------------------------------------------------------------------------------------------------
E. Darts
time limit per test: 5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
1
0 0 0 2 2 2 2 0
Output
1.0000000000
Input
1
-1 0 0 1 1 0 0 -1
Output
1.0000000000
Input
4
0 0 0 1 3 1 3 0
0 0 0 3 1 3 1 0
3 3 2 3 2 0 3 0
3 3 3 2 0 2 0 3
Output
1.5000000000
Input
2
-1 0 0 1 1 0 0 -1
0 0 1 1 2 0 1 -1
Output
1.1428571429
----------------------------------------------------------------------------------------------------
