diff options
Diffstat (limited to 'Data Structures/dynamic_segment_tree_2d.cpp')
-rw-r--r-- | Data Structures/dynamic_segment_tree_2d.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Data Structures/dynamic_segment_tree_2d.cpp b/Data Structures/dynamic_segment_tree_2d.cpp index 6948421..fe81b97 100644 --- a/Data Structures/dynamic_segment_tree_2d.cpp +++ b/Data Structures/dynamic_segment_tree_2d.cpp @@ -3,7 +3,7 @@ struct y_node { y_node* c[2]; y_node() { val = 0; c[0] = c[1] = 0; } y_node* get_c(int i) { return (!c[i] ? c[i] = new y_node : c[i]); } - void update(int y, int v, int l = -1, int r = MN) { + void update(int y, int v, int l = -1, int r = MX) { if (l == r) val += v; else { int m = (l + r) >> 1; @@ -11,7 +11,7 @@ struct y_node { val = (c[0] ? c[0]->val : 0) + (c[1] ? c[1]->val : 0); } } - int query(int yl, int yr, int l = -1, int r = MN) { + int query(int yl, int yr, int l = -1, int r = MX) { if (yl > r || yr < l) return 0; if (yl <= l && yr >= r) return val; int m = (l + r) >> 1; @@ -24,7 +24,7 @@ struct x_node { x_node* c[2]; x_node() { c[0] = c[1] = 0;} x_node* get_c(int i) { return (!c[i] ? c[i] = new x_node : c[i]); } - void update(int x, int y, int v, int l = -1, int r = MN) { + void update(int x, int y, int v, int l = -1, int r = MX) { if (l == r) seg.update(y, v); else { int m = (l + r) >> 1; @@ -32,7 +32,7 @@ struct x_node { seg.update(y, (c[0] ? c[0]->seg.query(y, y) : 0) + (c[1] ? c[1]->seg.query(y, y) : 0)); } } - int query(int xl, int xr, int yl, int yr, int l = -1, int r = MN) { + int query(int xl, int xr, int yl, int yr, int l = -1, int r = MX) { if (xl > r || xr < l) return 0; if (xl <= l && xr >= r) return seg.query(yl, yr); int m = (l + r) >> 1; |