aragorn专题

HDU 3966 Aragorn's Story 树链剖分

入门题 #include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 50010;struct edge{int v, next;}e[maxn*2];int n, m, q;int first[maxn], cnt;int top[maxn], tid[

hdu 3966 Aragorn's Story(树链剖分+树状数组)

题目链接:hdu 3966 Aragorn's Story 题目大意:给定一个棵树,然后三种操作 Q x:查询节点x的值I x y w:节点x到y这条路径上所有节点的值增加wD x y w:节点x到y这条路径上所有节点的值减少w 解题思路:树链剖分,用树状数组维护每个节点的值。 #pragma comment(linker, "/STACK:1024000000,1024000000