![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
树链剖分
1751074774
这个作者很懒,什么都没留下…
展开
-
【树链剖分模板】bzoj1036 树的统计
#include<cstdio> #include<algorithm> using namespace std; const int N=30000+5; int n,v[N]; int num,last[N],nxt[2*N],ver[2*N]; inline void add(int x,int y) {nxt[++num]=last[x]; last[x...原创 2018-09-21 19:30:01 · 107 阅读 · 0 评论 -
【树链剖分】【动态开点线段树】bzoj3531 旅行
每种信仰存一个线段树 动态开点线段树就是点 现用现开 所以要存左右儿子 一次询问最多新建logn节点 空间复杂度 m*logn #include<cstdio> #include<algorithm> using namespace std; const int N=100000+5; int n,w[N],c[N]; int num,last[N],nx...原创 2018-09-23 16:24:42 · 173 阅读 · 0 评论