#P3062. [USACO12DEC] Wifi Setup S
[USACO12DEC] Wifi Setup S
Description
Farmer John’s cows () stand at various positions along a straight path, which we can regard as a one-dimensional number line. Since his cows want to stay in email contact with each other, FJ plans to install Wifi base stations at positions of his choosing so that all cows have wireless coverage.
The cost of a Wifi base station depends on its transmission distance: a base station with power costs , where is the fixed installation cost and is the cost per unit distance. If a base station is installed at position , it provides coverage to any cow located in the interval . A base station with is allowed, but it only covers a cow located exactly at .
Given , , and the locations of FJ’s cows, determine the minimum total cost to provide wireless coverage for all cows. Base stations may be placed at any real position on the line.
Input Format
- Line 1: Three space-separated integers , , , where and .
- Lines to : Each line contains an integer in describing the location of one cow.
Output Format
- Line 1: The minimum total cost to provide wireless coverage to all cows.
3 20 5
7
0
100
57.5
Hint
There are cows at positions , , and . Installing a base station of power costs .
An optimal solution is to build one base station at position (power ) and another at position (power ). The first base station covers cows and , and the second covers cow .
Translated by ChatGPT 5
京公网安备 11011102002149号