const ll N = 1333;
int n;
struct BIT {
ll d[N][N];
inline ll lowbit(ll x) {return -x&x;}
void add (int x, int y, ll k) {
for (int i = x; i <= n; i += lowbit(i)) {
for (int j = y; j <= n; j += lowbit(j)) {
d[i][j] +=k;
}
}
}
ll ask(int x, int y) {
ll ret = 0;
for (int I = x; I >0; I -= lowbit(I)) {
for (int J = y; J > 0; J -= lowbit(J)) {
ret += d[I][J];
}
}
return ret;
}
}T;
原文:https://www.cnblogs.com/Xiao-yan/p/14693415.html