#P2605. [ZJOI2010] 基站选址

    ID: 1618 远端评测题 3000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>动态规划,dp2010线段树各省省选浙江

[ZJOI2010] 基站选址

Description

There are NN villages located on a straight line. For village ii (i>1i > 1), the distance to village 11 is DiD_i. You need to build at most KK communication base stations in these villages. The cost to build a base station at village ii is CiC_i. If there is a base station within a distance no more than SiS_i from village ii, then village ii is considered covered. If village ii is not covered, you must compensate it at a cost of WiW_i. Choose the locations of the base stations to minimize the total cost.

Input Format

  • The first line contains two integers N,KN, K, as described above.
  • The second line contains N1N-1 integers, D2,D3,,DND_2, D_3, \cdots, D_N, which are in ascending order.
  • The third line contains NN integers, C1,C2,,CNC_1, C_2, \cdots, C_N.
  • The fourth line contains NN integers, S1,S2,,SNS_1, S_2, \cdots, S_N.
  • The fifth line contains NN integers, W1,W2,,WNW_1, W_2, \cdots, W_N.

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 30%30\% of the testdata, N500N \leq 500.
  • For 100%100\% of the testdata, KNK \leq N, K100K \leq 100, N2×104N \leq 2 \times 10^4, Di109D_i \leq 10^9, Ci104C_i \leq 10^4, Si109S_i \leq 10^9, Wi104W_i \leq 10^4.

Translated by ChatGPT 5