题目链接:hdu 3966 Aragorn's Story
题目大意:给定一个棵树,然后三种操作
Q x:查询节点x的值
I x y w:节点x到y这条路径上所有节点的值增加w
D x y w:节点x到y这条路径上所有节点的值减少w
解题思路:树链剖分,用树状数组维护每个节点的值。
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
#define lowbit(x) ((x)&(-x))
const int maxn = 50000;
int N, M, Q, val[maxn......
阅读全文