diff options
-rw-r--r-- | Data Structures/dynamic_segment_tree_2d.cpp | 8 | ||||
-rw-r--r-- | Data Structures/seg_fenwick_tree.cpp | 2 | ||||
-rw-r--r-- | Data Structures/seg_ordered_set_tree.cpp | 8 | ||||
-rw-r--r-- | Data Structures/segment_tree.cpp | 2 | ||||
-rw-r--r-- | Graph/centroid.cpp | 4 | ||||
-rw-r--r-- | Graph/lca.cpp | 2 | ||||
-rw-r--r-- | Graph/tarjan_scc.cpp | 4 | ||||
-rw-r--r-- | Math/numtheory.cpp | 2 |
8 files changed, 16 insertions, 16 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; diff --git a/Data Structures/seg_fenwick_tree.cpp b/Data Structures/seg_fenwick_tree.cpp index b3dae30..d0b7066 100644 --- a/Data Structures/seg_fenwick_tree.cpp +++ b/Data Structures/seg_fenwick_tree.cpp @@ -22,7 +22,7 @@ struct node { int m = (l + r) >> 1; return (c[0] ? c[0]->query(a, b, l, m) : 0) + (c[1] ? c[1]->query(a, b, m + 1, r) : 0); } -} FT[MN]; +} FT[MX]; void update(int x, int y, int v) { for (; x < N; x += x & -x) FT[x].update(y, v); } int query(int x, int y1, int y2) { int ret = 0; for (; x > 0; x -= x & -x) ret += FT[x].query(y1, y2); return ret; } 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 { diff --git a/Data Structures/segment_tree.cpp b/Data Structures/segment_tree.cpp index a2b1d40..1d74f2c 100644 --- a/Data Structures/segment_tree.cpp +++ b/Data Structures/segment_tree.cpp @@ -1,5 +1,5 @@ template<typename T> struct seg_tree { - T seg[4*MN], tmp[4*MN]; + T seg[4*MX], tmp[4*MX]; inline T pull(const T & a, const T & b) { return a+b; } inline void push(int l, int r, int n) { seg[n] += (r-l+1)*tmp[n]; diff --git a/Graph/centroid.cpp b/Graph/centroid.cpp index 32d5a19..4dd5ac1 100644 --- a/Graph/centroid.cpp +++ b/Graph/centroid.cpp @@ -1,6 +1,6 @@ namespace centroid { - int sz[MN], cpar[MN]; - bitset<MN> vis; + int sz[MX], cpar[MX]; + bitset<MX> vis; void dfs(vector<int> * G, int u, int p = 0) { sz[u] = 1; for (int v : G[u]) if (v != p && !vis[v]) dfs(G, v, u), sz[u] += sz[v]; diff --git a/Graph/lca.cpp b/Graph/lca.cpp index bba90aa..38d972e 100644 --- a/Graph/lca.cpp +++ b/Graph/lca.cpp @@ -1,5 +1,5 @@ namespace lca { - int d[MN], L[MN][20]; + int d[MX], L[MX][20]; void dfs(vector<int> * G, int u = 1, int p = 0) { d[u] = d[p] + 1, L[u][0] = p; for (int i = 0; i < 18 && L[u][i]; i++) L[u][i + 1] = L[L[u][i]][i]; diff --git a/Graph/tarjan_scc.cpp b/Graph/tarjan_scc.cpp index f5b8d35..a9bad2e 100644 --- a/Graph/tarjan_scc.cpp +++ b/Graph/tarjan_scc.cpp @@ -1,7 +1,7 @@ namespace tarjan { - int cnt, scc_num, scc[MN], in[MN], low[MN]; + int cnt, scc_num, scc[MX], in[MX], low[MX]; stack<int> s; - bitset<MN> ins; + bitset<MX> ins; void tarjan(vector<int> * G, int u) { low[u] = in[u] = cnt++, ins[u] = 1; s.push(u); for (int v : G[u]) { diff --git a/Math/numtheory.cpp b/Math/numtheory.cpp index 02228e2..a019b05 100644 --- a/Math/numtheory.cpp +++ b/Math/numtheory.cpp @@ -11,7 +11,7 @@ inline ll pw(ll base, ll exp) { inline ll inv(ll x) { return pw(x, MOD-2); } -ll fact[MN] = { 1 }, ifact[MN] = { 1 }; +ll fact[MX] = { 1 }, ifact[MX] = { 1 }; inline ll nCr(int n, int k) { return fact[n]*ifact[k]%MOD*ifact[n-k]%MOD; } |