EC_MODE - Modems
A Oruro province wants ALL the towns to have Internet access and to communicate with each other by at least one channel (not necessarily direct). The engineer in charge asks you to help him determine the minimum cost of providing this access.
There are N towns in total (1 <= N <= 1000). UTP can be used only up to range R (1<=R<=10000). If this distance is exceeded, optical fiber must be used instead. The unit cost of using UTP cable is U and the unit price of the optical fiber is V (U <= V; 1 <= U, V <= 10). There are also W satellite modems purchased (1 <= W < N). These satellite modems can be placed in any town. Satellite modem will allow a town to use the internet and communicate with any other modem in the province.
Input
The first line contains the number of test cases. First line of each test case consists of five integers N, R, W, U, V. Then N lines follow, each with integer pair xi, yi (-10000 <= xi, yi <= 10000), the coordinates of i-th town.
Output
For each case, print a line of the form:
Caso #TC: A B
Where TC is the test case number, A is the total cost of using UTP cable and B is the total cost of using optical fiber. Print both A and B rounder to 3 decimal places.
Example
Input: 2 3 1 1 1 1 0 0 0 1 1 0 6 1 3 2 3 0 0 0 2 2 0 3 2 2 3 3 3 Output: Caso #1: 2.000 0.000 Caso #2: 4.000 6.000
hide comments
Andy:
2014-09-16 08:55:51
please make the problem statement clearer or explain the test case. |
|
wisfaq:
2014-09-16 08:55:51
Please undo unnecessary language restrictions. Last edit: 2013-10-28 22:16:47 |
|
wisfaq:
2014-09-16 08:55:51
Why language restrictions? |
Added by: | Eddy Cael |
Date: | 2013-10-25 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | C CSHARP C++ 4.3.2 CPP HASK JAVA PAS-FPC PYTHON RUBY |
Resource: | Competencia CCBOL 2013 |