Codeforces Round 168 (Div. 1)


A. k-Multiple Free Set
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
6 2
2 3 6 5 4 10
Output
3
----------------------------------------------------------------------------------------------------
B. Zero Tree
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
1 2
1 3
1 -1 1
Output
3
----------------------------------------------------------------------------------------------------
C. The Last Hole!
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
0 0
1 1
2 2
Output
-1
Input
4
0 0
0 2
2 2
2 0
Output
1.414214
Input
4
0 1
0 -1
-2 0
4 0
Output
2.125000
----------------------------------------------------------------------------------------------------
D. Lovely Matrix
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3
1 -1 -1
1 2 1
2 -1 1
Output
3 1 2 
Input
2 3
1 2 2
2 5 4
Output
1 3 2 
Input
2 3
1 2 3
3 2 1
Output
-1
----------------------------------------------------------------------------------------------------
E. Mirror Room
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 0
1 2 SW
Output
6
Input
7 5 3
3 3
4 3
5 3
2 1 SE
Output
14
----------------------------------------------------------------------------------------------------
