#P2605. [ZJOI2010] 基站选址
[ZJOI2010] 基站选址
Description
There are villages located on a straight line. For village (), the distance to village is . You need to build at most communication base stations in these villages. The cost to build a base station at village is . If there is a base station within a distance no more than from village , then village is considered covered. If village is not covered, you must compensate it at a cost of . Choose the locations of the base stations to minimize the total cost.
Input Format
- The first line contains two integers , as described above.
- The second line contains integers, , which are in ascending order.
- The third line contains integers, .
- The fourth line contains integers, .
- The fifth line contains integers, .
Output Format
Output a single integer, the minimum total cost.
3 2
1 2
2 3 2
1 1 0
10 20 30
4
Hint
Constraints:
- For of the testdata, .
- For of the testdata, , , , , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号