錒——放一個(不)通用的二分棧優化決策單調性DP板子

返回值爲在最優條件下使用最少點數web int Gans(ll del,int n) { int hd=1,tl=0; st[0]=1; qu[++tl]=0; for(int i=1;i<=n;i++) { while(hd<tl&&st[qu[hd+1]]<=i)++hd; int now=qu[hd]; f[i]=G(i,now)+del; use[i]=use[n
相關文章
相關標籤/搜索