daily pastebin goal
52%
SHARE
TWEET

Untitled

a guest May 19th, 2017 43 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void update (int v, int tl, int tr, int l, int r, int add) {
  2.     if (l > r)
  3.         return;
  4.     if (l == tl && tr == r)
  5.         t[v] += add;
  6.     else {
  7.         int tm = (tl + tr) / 2;
  8.         update (v*2, tl, tm, l, min(r,tm), add);
  9.         update (v*2+1, tm+1, tr, max(l,tm+1), r, add);
  10.     }
  11. }
RAW Paste Data
Top