![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
主席树
Love_xyh
这个作者很懒,什么都没留下…
展开
-
BZOJ 2588: Count on a tree
加个dfs序就可以把静态kth移到树上来做。树上差分一下即可。 顺便再多写一个dfs用以树剖求lca。 #include <bits/stdc++.h> using namespace std; const int N=1e5+5; int n,q,m,u,v,t,LCA,cnt,last; int ll[N<<5],rr[N<<5],sum[N<<...原创 2020-03-10 21:29:14 · 120 阅读 · 0 评论 -
BZOJ 3524:[POI2014]KUR-Couriers
很裸的板子题。 就当把模板打得熟练点罢了。 #include <bits/stdc++.h> using namespace std; const int N=5e5+5; int n,q,m,x,y,t,cnt; int a[N],b[N],ll[N<<5],rr[N<<5],sum[N<<5],T[N<<5]; int build(...原创 2020-03-09 18:13:13 · 114 阅读 · 0 评论 -
洛谷 P3834 可持久化线段树 2(主席树)
因为太菜了,所以也不知道这题的算法到底应该叫做什么,看hzw博客中把这题归到主席树了,那我也归到主席树里吧。 其实我连主席树定义都不知道… #include <bits/stdc++.h> using namespace std; const int N=2e5+5; int n,q,m,x,y,t,cnt; int a[N],b[N],ll[N<<5],rr[N<&...原创 2020-03-09 18:10:10 · 100 阅读 · 0 评论