fork download
  1. void UpDate(Node *p, int x, int y, int L, int R, w)
  2. {
  3. if (y < L || R < x) return;
  4. if (x <= L && R <= y)
  5. {
  6. p -> Delta += w;
  7. return;
  8. }
  9. if (p -> Left == null) p -> Left = new Node(0, 0, NULL, NULL);
  10. if (p -> Right == null) p -> Right = new Node(0, 0, NULL, NULL);
  11. p -> Left -> Delta += p -> Delta;
  12. p -> Right -> Delta += p -> Delta;
  13. p -> Delta = 0;
  14. int m = (x + y) >> 1;
  15. UpDate(p -> Left, x, m, L, R, w);
  16. UpDate(p -> Right, m + 1, y, L, R, w);
  17. p -> Sum = p -> Left -> Sum + (m - x + 1)*p -> Left -> Delta + p -> Right -> Sum + (y - m )*p -> Right -> Delta;
  18. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:13: error: variable or field 'UpDate' declared void
 void UpDate(Node *p, int x, int y, int L, int R, w)
             ^
prog.cpp:1:13: error: 'Node' was not declared in this scope
prog.cpp:1:19: error: 'p' was not declared in this scope
 void UpDate(Node *p, int x, int y, int L, int R, w)
                   ^
prog.cpp:1:22: error: expected primary-expression before 'int'
 void UpDate(Node *p, int x, int y, int L, int R, w)
                      ^
prog.cpp:1:29: error: expected primary-expression before 'int'
 void UpDate(Node *p, int x, int y, int L, int R, w)
                             ^
prog.cpp:1:36: error: expected primary-expression before 'int'
 void UpDate(Node *p, int x, int y, int L, int R, w)
                                    ^
prog.cpp:1:43: error: expected primary-expression before 'int'
 void UpDate(Node *p, int x, int y, int L, int R, w)
                                           ^
prog.cpp:1:50: error: 'w' was not declared in this scope
 void UpDate(Node *p, int x, int y, int L, int R, w)
                                                  ^
stdout
Standard output is empty