题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3469
dp[i][j][0] := 派送区间[i,j]的用户并且最后派送 i 时的最小值 dp[i][j][1] := 派送区间[i,j]的用户并且最后派送 j 时的最小值 dp[i][j][0] = min(dp[i+1][j][0]+cost1, dp[i+1][j][1]+cost2) dp[i][j][1] = min(dp[i][j-1][0]+cost3, dp[i][j-1][1]+cost4)
cost1 = (x[i+1]-x[i])*(sum[n]-sum[j]+sum[i])cost2 = (x[j]-x[i+1])*(sum[n]-sum[j]+sum[i])cost3 = (x[j]-x[i])*(sum[n]-sum[j-1]+sum[i-1])cost4 = (x[j]-x[j-1])*(sum[n]-sum[j-1]+sum[i-1])
时间: 2024-12-06 17:55:14