Aragorn's Story Time Limit: 10000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10510 Accepted Submission(s): 2766 Problem Description Our protagonist is the handsome human prince Aragorn comes from The Lor…
原题链接 对于以u为根的子树,后代节点的dfn显然比他的dfn大,我们可以记录一下回溯到u的dfn,显然这两个dfn构成了一个连续区间,代表u及u的子树 剩下的就和树剖一样了 #include<cstdio> #include<algorithm> #include<cstring> #define N 100010 typedef long long ll; using namespace std; int ecnt,head[N],son[N],fa[N],sz[N…
题意: http://acm.hdu.edu.cn/showproblem.php?pid=3966 给一棵树,并给定各个点权的值,然后有3种操作: I x y z : 把x到y的路径上的所有点权值加上z D x y z:把x到y的路径上的所有点权值减去z Q z:查询节点编号为x的权值 这里主要放下用树状数组维护的模板 区间修改单点查询 好像用线段树更好? em.... 两种都放好了~ 好像说hduoj是windows系统容易爆栈 手动扩栈加这句 #pragma comment(linker,…