http://acm.pku.edu.cn/JudgeOnline/problem?id=3321
#include <iostream>using namespace std;
const int N=100001;
inline int lowbit(int x) //返回2^k,其中k是x末尾0的个数{ return x & (x^(x-1)); //x & (-x)}
struct Node{ Node(int v=0,Node * n=NULL):vertex(v),next(n){} int vertex; Node * next;};
Node * graph[N];
int DFSBegin[N],DFSEnd[N],depth,TreeArr[N]={0},n;bool vst[N]={false};
int apple[N]={0};
void Modify(int pos,int d){ while(pos<=n) { TreeArr[pos]+=d; pos+=lowbit(pos); }}......
阅读全文