//树剖(需求:区间修改,点查询) //剖分结束后,线段树维护区间和 #include<iostream> #include<cstdio> #include<cstring> #include<vector> usingnamespacestd; #define ll long long #define lson (rt<<1) #define rson (rt<<1|1) constint maxn=5e4+10; int a[maxn]; int n,m,p; struct{ ll val,lazy; }t[maxn<<2];
vector<int> e[maxn]; int dep[maxn]; int fa[maxn]; int siz[maxn]; int son[maxn]; //重儿子 int dfn[maxn]; //树上dfs序 int rnk[maxn]; //dfn的逆映射,用于建立线段树 int top[maxn]; //所在重链的头部