You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
void add(int x, int v)
|
|
{
|
|
for (; x <= n; x += lowbit(x))
|
|
A[x] += v;
|
|
}
|
|
|
|
void sum(int x)
|
|
{
|
|
int res = 0;
|
|
for (; x; x -= lowbit(x))
|
|
res += A[x];
|
|
return res;
|
|
}
|