摘要: int head[N],hcnt; int n,m,flag,L,R; int son[N],siz[N],fa[N],top[N]; int id[N],tid,dep[N],posi[N]; LL seg[N>1;LL temp=0; if(Lmid) temp+=query(rson); return temp; } void update(int rt,int l,int... 阅读全文
posted @ 2016-10-06 10:57 Kurokey 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 题目链接:传送门 题目大意:中文题,略 题目思路:网上有题解说是合并线段树的,但是太难蒟蒻不会,只能用树剖求解 如果不是树而是一维数组我们会怎么解? 当然是利用前缀和思想标记 (L) v+1,(R+1) v-1,然后扫一遍 用线段树取最大复杂度 nlogn 现在是搬到了树上,怎么做? 利用树链剖分拆 阅读全文
posted @ 2016-10-06 10:53 Kurokey 阅读(299) 评论(0) 推荐(0) 编辑