邓心一 4 년 전
부모
커밋
e9081c97c9
1개의 변경된 파일3개의 추가작업 그리고 4개의 파일을 삭제
  1. 3 4
      leetcode/hard/732.cc

+ 3 - 4
leetcode/hard/732.cc

@@ -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) {