The up function is used to update the value of the Father's Day point void push (int w) {sum [w] = sum [2 * w] + sum [2 * w + 1]; // update node value} spof update first finds the number of P and then updates its value void add (int p, int D, int L, int R, int W) {If (L = r) {sum [w] + = D; return;} int M = (L + r)/2; If (P <= m) add (p, D, L, M, 2 * w); else add (p, D, m + 1, R, 2 * w + 1 ); push (w );} **************************************** ** interval summation int query (INT P1, int P2, int L, int R, int W) {If (P1 <= L & P2> = r) // The range is completely overwritten return sum [w]; int M = (L + r)/2; int Re = 0; If (P1 <= m) RE + = query (P1, P2, L, M, 2 * w); If (P2> m) RE + = query (P1, P2, m + 1, R, 2 * w + 1); Return re ;} ************************************* 88 interval Update down function void Pushdown (int w, int m) {If (LZ [w]) {LZ [2 * w] + = LZ [w]; LZ [2 * w + 1] + = LZ [w]; sum [2 * w] + = (LZ [w] * (m-(m/2 ))); sum [2 * w + 1] + = (LZ [w] * (M/2); LZ [w] = 0; // remove latency tags} void Update (int A, int B, int da, int L, int R, int W) {if (a <= L & B> = r) {LZ [w] + = da; // Multiple Delay markers sum [w] + = da * (R-l + 1); return;} Pushdown (W, R-l + 1 ); // update int M = (L + r)/2; if (a <= m) add (a, B, da, L, M, 2 * w ); if (B> m) add (a, B, da, m + 1, R, 2 * w + 1); pushup (w );}