const int MAXN = 1050;
int N;
int tree[MAXN][MAXN];
int lowbit(int x)
{
return x&(-x);
}
void Add(int x,int y,int val)
{
for (int i=x ; i<=N ; i+=lowbit(i))
for (int j=y ; j<=N ; j+=lowbit(j))
tree[i][j] += val;
}
int Query(int x,int y)
{
int ans=0;
for (int i=x ; i>0 ; i-=lowbit(i))
for (int j=y ; j>0 ; j-=lowbit(j))
ans += tree[i][j];
return ans;
}
inline void init()
{
memset(tree,0,sizeof tree);
}
转载于:https://www.cnblogs.com/vocaloid01/p/9514024.html