aboutsummaryrefslogtreecommitdiff
path: root/Data Structures
diff options
context:
space:
mode:
authorAnthony Wang2020-08-21 11:42:33 -0500
committerAnthony Wang2020-08-21 11:42:33 -0500
commit6e682272268bc6905f00688d18ed46df78de8297 (patch)
treed0a83689085e7a09d92695e19aa9a10fec52f00a /Data Structures
parentd69a1eed7e64acbf8aaf2551c2286e82c37b8543 (diff)
Enforce consistent style
Diffstat (limited to 'Data Structures')
-rw-r--r--Data Structures/dynamic_segment_tree_2d.cpp8
-rw-r--r--Data Structures/seg_ordered_set_tree.cpp8
-rw-r--r--Data Structures/segment_tree.cpp2
3 files changed, 9 insertions, 9 deletions
diff --git a/Data Structures/dynamic_segment_tree_2d.cpp b/Data Structures/dynamic_segment_tree_2d.cpp
index c19a488..6948421 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 = MAXN) {
+ void update(int y, int v, int l = -1, int r = MN) {
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 = MAXN) {
+ int query(int yl, int yr, int l = -1, int r = MN) {
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 = MAXN) {
+ void update(int x, int y, int v, int l = -1, int r = MN) {
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 = MAXN) {
+ int query(int xl, int xr, int yl, int yr, int l = -1, int r = MN) {
if (xl > r || xr < l) return 0;
if (xl <= l && xr >= r) return seg.query(yl, yr);
int m = (l + r) >> 1;
diff --git a/Data Structures/seg_ordered_set_tree.cpp b/Data Structures/seg_ordered_set_tree.cpp
index b1d9005..d17a9c7 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 MAXN = 100001;
+constexpr int MN = 100001;
-ordered_set<int> S[4 * MAXN];
+ordered_set<int> S[4 * MN];
-void update(int x, int y, int l = 0, int r = MAXN, int n = 1) {
+void update(int x, int y, int l = 0, int r = MN, 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 = MAXN, int n = 1) {
S[n].insert(y);
}
-int query(int xl, int xr, int yl, int yr, int l = 0, int r = MAXN, int n = 1) {
+int query(int xl, int xr, int yl, int yr, int l = 0, int r = MN, 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 {
diff --git a/Data Structures/segment_tree.cpp b/Data Structures/segment_tree.cpp
index 942a8fe..a2095ce 100644
--- a/Data Structures/segment_tree.cpp
+++ b/Data Structures/segment_tree.cpp
@@ -1,4 +1,4 @@
-int seg[4*MAXN], tmp[4*MAXN];
+int seg[4*MN], tmp[4*MN];
inline int pull(const int & a, const int & b) { return a + b; }
inline void push(int l, int r, int n) {
seg[n] += (r - l + 1) * tmp[n];