|
@@ -25,6 +25,7 @@ public:
|
|
|
|
|
|
private:
|
|
|
struct SegNode {
|
|
|
+ // "lazy" only apply to children, not node itself
|
|
|
int lazy;
|
|
|
int k;
|
|
|
int lc;
|
|
@@ -52,10 +53,8 @@ private:
|
|
|
}
|
|
|
|
|
|
void push_up(int pos) {
|
|
|
- if (st[pos].lc != 0)
|
|
|
- st[pos].k = std::max(st[pos].k, st[st[pos].lc].k);
|
|
|
- if (st[pos].rc != 0)
|
|
|
- st[pos].k = std::max(st[pos].k, st[st[pos].rc].k);
|
|
|
+ if (st[pos].lc != 0) st[pos].k = std::max(st[pos].k, st[st[pos].lc].k);
|
|
|
+ if (st[pos].rc != 0) st[pos].k = std::max(st[pos].k, st[st[pos].rc].k);
|
|
|
}
|
|
|
|
|
|
void update(int pos, int val, int l, int r, int ql, int qr) {
|