随笔分类 - 线段树
摘要:首先是动态(开点)树,以数列操作为例 点击查看代码 #include<bits/stdc++.h> #define lson tr[id].l #define rson tr[id].r using namespace std; const int N=1e6+20; int a[N]; struc
阅读全文
摘要:前情提要,我主要看的是这位大佬的讲解,用的是谷的代码,所以会有点奇怪 大概就是这么个意思 dfs1用来处理树的dfs序,处理出重链大小和对应的重儿子 void dfs1(int now){ son[now]=-1; siz[now]=1; for(int i=head[now];i;i=edge[i
阅读全文
摘要:前情提要,因为大家写树剖卡在线段树了,故写一篇博客来探讨线段树 帮助 抬走大家 单点修改的线段树 先贴代码 #include<bits/stdc++.h> #define lson id<<1 #define rson id<<1|1 using namespace std; const int N
阅读全文