版本比较
题解:P3994 高速公路
正文
增加 1 行删除 1 行
31 行未改动323334353636373839407 行未改动31 行未改动 while(h < t && slope(q[h], q[h + 1]) < a[u]) ++h; if(h <= t) f[u] = min(f[u], f[q[h]] + a[u] * (s[u] - s[q[h]]) + b[u]); while(h < t && slope(q[t], q[t - 1]) >= slope(q[t], u)) --t; q[++t] = u;
for(auto v : G[u]){ if(v == son[u]) continue; dfs2(v, h, t); }7 行未改动