Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const ll Max=2*10e5;
- ll tree[Max+10];
- ll query(ll idx)
- {
- ll sum=0;
- while(idx>0)
- {
- sum+=tree[idx];
- idx-= idx & (-idx);
- }
- return sum;
- }
- void update(ll idx,ll x,ll n)
- {
- while(idx<=n)
- {
- tree[idx]+=x;
- idx+= idx & (-idx);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement