diff options
Diffstat (limited to 'Data Structures/seg_ordered_set_tree.cpp')
-rw-r--r-- | Data Structures/seg_ordered_set_tree.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Data Structures/seg_ordered_set_tree.cpp b/Data Structures/seg_ordered_set_tree.cpp index 2a11ee8..efc5815 100644 --- a/Data Structures/seg_ordered_set_tree.cpp +++ b/Data Structures/seg_ordered_set_tree.cpp @@ -3,11 +3,11 @@ using namespace std; using namespace __gnu_pbds; template<typename T> using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>; -constexpr int MN = MN; +constexpr int MX = MX; -ordered_set<int> S[4 * MN]; +ordered_set<int> S[4 * MX]; -void update(int x, int y, int l = 0, int r = MN, int n = 1) { +void update(int x, int y, int l = 0, int r = MX, int n = 1) { if (l != r) { int m = (l + r) >> 1; x <= m ? update(x, y, l, m, n << 1) : update(x, y, m + 1, r, n << 1 | 1); @@ -15,7 +15,7 @@ void update(int x, int y, int l = 0, int r = MN, int n = 1) { S[n].insert(y); } -int query(int xl, int xr, int yl, int yr, int l = 0, int r = MN, int n = 1) { +int query(int xl, int xr, int yl, int yr, int l = 0, int r = MX, int n = 1) { if (l > r || l > xr || r < xl) return 0; if (l >= xl && r <= xr) return S[n].order_of_key(yr + 1) - S[n].order_of_key(yl); else { |