diff options
author | Ta180m | 2019-11-27 21:20:11 -0600 |
---|---|---|
committer | Ta180m | 2019-11-27 21:20:11 -0600 |
commit | e82dc7de44b56a6c476cfbd88d11c3d7a7bd73da (patch) | |
tree | b4f3a38f2d19f84402e91560976a658a1fa69e77 /Data Structures | |
parent | ad8ab4144536c54bbbfd816a64152cf8d4e43727 (diff) |
update
Diffstat (limited to 'Data Structures')
-rw-r--r-- | Data Structures/segment_tree_v2.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Data Structures/segment_tree_v2.cpp b/Data Structures/segment_tree_v2.cpp index 7057680..5b3553a 100644 --- a/Data Structures/segment_tree_v2.cpp +++ b/Data Structures/segment_tree_v2.cpp @@ -53,11 +53,11 @@ public: } void update(int a, int b, T v, int l = 0, int r = -1, int n = 1) { if (r == -1) r = N - 1; - push(n, l, r); + push(l, r, n); if (l > b || r < a) return; if (l >= a && r <= b) { tmp[n] = v; - push(n, l, r); + push(l, r, n); } else { int m = (l + r) >> 1; @@ -68,7 +68,7 @@ public: T query(int a, int b, int l = 0, int r = -1, int n = 1) { if (r == -1) r = N - 1; if (l > b || r < a) return 0; - push(n, l, r); + push(l, r, n); if (l >= a && r <= b) return seg[n]; int m = (l + r) >> 1; return query(a, b, l, m, n << 1) + query(a, b, m + 1, r, n << 1 | 1); |