• 2024-08-28P4655 [CEOI2017] Building Bridges
    题意思路设\(sum_i=\sum\limits_{j=1}^iw_j\)。可以得到转移方程\(f_i=f_j+(h_i-h_j)^2+sum_i-sum_j\)。转化为\(y=kx+b\)的形式:\(f_i=f_j+(h_i-h_j)^2+sum_i-sum_j=f_j+h_i^2+h_j^2-2h_ih_j+sum_i-sum_j=(-2h_ih_j)+
  • 2024-05-14C121 李超树+DP P4655 [CEOI2017] Building Bridges
    视频链接:C121李超树+DPP4655[CEOI2017]BuildingBridges_哔哩哔哩_bilibili   LuoguP4655[CEOI2017]BuildingBridges#include<iostream>#include<cstring>#include<algorithm>usingnamespacestd;#definelllonglong#definelsu<<