摘要: 用线段树由低到高覆盖每一层台阶的长度,根据线段左右两端连边,然后由高到底DP即可#include #include using namespace std;const int maxn= 200001;const int mincost=-200000000;struct Pool{ int to,pre;}pool[maxn=r) { m[rt]=s; lazy[rt]=s; defi[rt]=true; return ; } pushdown(rt); int mid=(l+r)>>1; if(mi... 阅读全文
posted @ 2013-08-07 17:06 acahesky 阅读(272) 评论(0) 推荐(0) 编辑
摘要: sl代表当前线段从最右端开始的最大长度,sr代表最左端s代表当前线段和,ss当前最大字段长ss的值从三种状态转移而来,ss[rt#include using namespace std;const int maxn=100001;int n,m;int s[maxn>1; if(l!=r) { init(rt>1; if(m>=t) change(rt<<1,l,m,t,tt); else change(rt<<1|1,m+1,r,t,tt); pushup(rt); }}in... 阅读全文
posted @ 2013-08-07 17:04 acahesky 阅读(224) 评论(0) 推荐(0) 编辑