洛谷P2120 [ZJOI2007]仓库建设 斜率优化DP

时间:2024-11-23 11:33:49

做的第一道斜率优化\(DP\)QwQ

原题链接1/原题链接2

首先考虑\(O(n^2)\)的做法:设\(f[i]\)表示在\(i\)处建仓库的最小费用,则有转移方程:

$f[i]=min\{f[j]+\sum\limits_{k=j+1}^{i}P[k](X[i]-X[k])\}+C[i]$
于是我们枚举$i$,再从$i-1$开始从大到小枚举$j$,并记录一个前缀和,每次更新一下$f[i]$。洛咕上貌似拿了66分,数据太水:
```cpp
#include

using namespace std;

define ll long long

define N 1000000

define re register

int n, X[N+5], P[N+5], C[N+5];

ll f[N+5];

inline char Getchar() {

static char buf[100000], *p1 = buf, p2 = buf;

return p1p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1p2)?EOF:
p1++;

}

inline int read() {

int s = 0; re char c = Getchar();

while(c < '0' || c > '9') c = Getchar();

while(c >= '0' && c <= '9') s = s*10+c-'0', c = Getchar();

return s;

}

template T min(T x, T y) { return x < y ? x : y; }

int main() {

n = read();

for(re int i = 1; i <= n; ++i) X[i] = read(), P[i] = read(), C[i] = read(), f[i] = 9223372036854775807LL;

f[0] = 0;

for(re int i = 1; i <= n; ++i) {

ll sum = 0, d = 0;

for(re int j = i-1; j >= 0; --j) {

f[i] = min(f[i], f[j]+sum+C[i]);

d += X[j+1]-X[j];

sum += P[j]*d;

}

}

printf("%lld", f[n]);

return 0;

}

那正解应该怎么做呢?经过观察,发现上面的转移方程已经无法再进行常规的优化了,此时我们需要斜率优化了。就拿这道题来说吧:
首先我们改写一下转移方程。若令:
<center>$sum1[i]=\sum\limits_{j=1}^{i}P[j]\ \ \ \ sum2[i]=\sum\limits_{j=1}^{i}P[j]X[j]$</center>
则$f[i]$可表示为:
<center>$f[i]=min\{f[j]+X[i](sum1[i]-sum1[j])-(sum2[i]-sum2[j])\}+C[i]$</center>
此时转移到了$i$,对于$j>k,j,k\in[0,i-1]$来说,若选$j$比选$k$更优,我们可以得到下式:
$$f[j]+X[i](sum1[i]-sum1[j])-(sum2[i]-sum2[j])<f[k]+X[i](sum1[i]-sum1[k])-(sum2[i]-sum2[k])\\
=>f[j]+sum2[j]-f[k]-sum2[k]<X[i]sum1[j]-X[i]sum1[k]\\
=>\frac{f[j]+sum2[j]-f[k]-sum2[k]}{sum1[j]-sum1[k]}<X[i]$$
当上式成立时,选$j$更优
此时我们令$y_i=f[i]+sum2[i],x_i=sum1[i]$,则上式表示的就是平面上两点$P_j$和$P_k$所确定的直线的斜率。如果我们把所有转移点的图像绘制出来的话,会长成下面这样:
<img src='data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAzMAAAHMCAIAAABukmEEAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABrZSURBVHhe7d0xkhvXtcdhhgwVOnCgwAtw7MSp
QoUMFakUagcKmTpTyCUwEzfhKi3AC1DkUsjQrx/6fxvg7QE4M8ABLtDfV6dUw3OA0atXMvGrwQz5
5n8AAIxBmQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEAjEKZ
AQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEA
jEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxC
mQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkBAIxCmQEAjEKZAQCMQpkB
AIxCmZX79OnTtzsfPnzICgDgKcqs3F/+8pc3O2/fvs0KAOApyqzQn3/++fPPP89ZNvv9999zAwBY
UWZVPn78+M0336TImu+//z5nAIAVZVbi06dP6yybvX//Pg8CAPiSMruwDx8+fPvtt6mwp/huMwDg
GGV2Sb/++mv6q/npp5/y0YE8GgDgSyrhkpYfw5xNWTYt84sD84MBADoq4ZJSXm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lgEAa8qsXIqsmTZdlk0z
PxIA2DhlVi5F1vz3r3+TZQDAk5RZuSXI5plSbPlAmQEAh5RZuaXJjk0eBwBsnjKr1UXYscmjAbbn
06dP33777Zs3b6Z/fvjwIVvYKmVWqyuwY5NHA2zPnGWzt2/fZgtbpcwKdfl1evIcgI15//59uqzx
xTO2TJkV6trr9OQ5AJv0888/p8t23r59K87YJmVWqGuv05PnAGzS58+ff/jhh3TZjnc22SZlVqUL
r69OngawbYdvbnpbkw1SZlW68Opm+h2n20wz/04EsGXT75/dO5v6jE1RZoW68Do9+R0IYPPW72xO
9Bkbocxqdfl1YvJ7D8Dmzb9/rn9m03eesQXKrFDXXqcnv/EAbF5+D93p+ixbeFz+K6/V5dexyW85
AJuX3z2bT58+ffPNN7kpMzbAf+W1ugI7Nnk0AM3ytzYtfvrpp9zgcSmzcl2ErSePA6D58OHD4ZfK
JrKMjVBmV9LV2Dy5AXDgl19+SY41soztUGbXJsgA1v78888pyLq3LyeajK1RZgDc2MePH7v3Liff
fffd58+f8wjYDGUGwC11P305e/funSxjm5QZADfTZZk/5R+UGQC30f0Apm8pg4kyA+AGfv311xTZ
jiyDmTID4AYOfwxTlsFCmQFwA/MfWvb999/7Tn84pMwAuI0//vgjHwGNMgMAGIUyAwAYhTIDABiF
MgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTID
ABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAY
hTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUy
AwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMAGIUyAwAYhTIDABiFMgMA
GMP//vd/XcQ3t05AXyMAAAAASUVORK5CYII='/>
观察绿色的部分,我们会发现一些有趣的性质:
<img src='data:img/jpg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7LqCAzsy5pOjzTZACN1q1bt379+vRinCyjOpRZtyWJJsgA
6rz99tsbN2585JFHaudkCU1G1SgzAHrs8ccfX7lyZRJn6fW4b37zmz/96U/nzp2bXkM1OGcGQC/t
2LGjMcuWLVsmy6gmMzMAeibJsuXLl2dZNjIy4in/VJyZGQC9EW7AzLJs9erVsgzMzADogeHh4TVr
1qQXTvrDacoMgB5YsGBBdhumLIOM3UwAeuC73/1u8s+rr776+PHjsgwyZmYA9MaRI0fOOuus9AIY
p8wAAGJhNxMAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwAIBbK
DAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwA
IBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAW
ygwAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoMACAWygwAIBbKDAAgFsoM
ACAWygwAIBbKDAAgFsoMACAOs2b9fzVjfwepVVTbAAAAAElFTkSuQmCC'/>
分类讨论,有以下$3$种情况:
1.$X[i]>Slope(k,j)>Slope(j,i)$,$j$比$k$,$i$比$j$优
2.$Slope(k,j)>X[i]>Slope(j,i)$,$k$比$j$,$i$比$j$优
3.$Slope(k,j)>Slope(j,i)>X[i]$,$k$比$j$,$j$比$i$优
也就是说,在这种情况下,选$j$无论如何也不可能是最优的,于是我们可以把$j$去掉了。然后,得到的是一个下凸(是下凸吧)函数的图像:
<img src='data:img/jpg;base64,iVBORw0KGgoAAAANSUhEUgAAAzMAAAHMCAIAAABukmEEAAAAAXNSR0IArs4c6QAAAARnQU1BAACx
jwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAABLrSURBVHhe7d0xbFRnuoBhz1ZOF3EbIl2kWMK3
uKIgSgdNyrC3QSmuTBVosF0BHUiRwNJKkM5U9qaxUwVtkdAsdpk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/>
此时我们再看看从这个图像上的哪一个点转移最优:假设$Slope(j,i)>X[i],Slope(k,j)<X[i]$,不难得出,$j$比左边所有的点都优,比右边的点也都优。所以我们从$j$点转移是最优的。又因为$X[i]$具有单调性,所以我们维护一个单调队列,每次从斜率大于等于$X[i]$的第一条直线的左端点转移就好了。
```cpp
#include <cstdio> using namespace std; #define N 1000000
#define ll long long
#define re register int n, h = 1, t = 1, q[N+5], X[N+5], P, C[N+5];
ll f[N+5], sum1[N+5], sum2[N+5]; inline char Getchar(){
static char buf[2048], *p1=buf, *p2=buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,1,2048,stdin),p1==p2)?EOF:*p1++;
} inline int read() {
int s = 0; char c = Getchar();
while(c < '0' || c > '9') c = Getchar();
while(c >= '0' && c <= '9') s = s*10+c-'0', c = Getchar();
return s;
} template <typename T> T min(T x, T y) { return x < y ? x : y; } inline double getK(const int &j, const int &k) {
return 1.0*(f[j]+sum2[j]-f[k]-sum2[k])/(sum1[j]-sum1[k]);
} int main() {
n = read();
for(int i = 1; i <= n; ++i) {
X[i] = read(), P = read(), C[i] = read();
sum1[i] = sum1[i-1]+P, sum2[i] = sum2[i-1]+P*X[i];
f[i] = X[i]*sum1[i]-sum2[i]+C[i];
}
for(int i = 1, j; i <= n; ++i) {
while(h+1 < t && getK(q[h], q[h+1]) < X[i]) h++;
j = q[h];
if(j) f[i] = min(f[i], f[j]+X[i]*(sum1[i]-sum1[j])-(sum2[i]-sum2[j])+C[i]);
while(h+1 < t && getK(q[t-2], q[t-1]) > getK(q[t-1], i)) t--;
q[t++] = i;
}
printf("%lld\n", f[n]);
return 0;
}