Skip to content

Commit 359e1a9

Browse files
committed
revert
1 parent dc48807 commit 359e1a9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

library/data_structures/seg_tree_uncommon/implicit.hpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@
22
//! @code
33
//! implicit_seg_tree<10'000'000> ist(l, r);
44
//! @endcode
5-
template <int N> struct implicit_seg_tree {
6-
using dt = array<int, 2>; //!< min, number of mins
5+
template<int N> struct implicit_seg_tree {
6+
using dt = array<ll, 2>; //!< min, number of mins
77
static dt op(const dt& l, const dt& r) {
88
if (l[0] == r[0]) return {l[0], l[1] + r[1]};
99
return min(l, r);
1010
}
11-
static constexpr dt unit{INT_MAX, 0};
11+
static constexpr dt unit{LLONG_MAX, 0LL};
1212
struct node {
1313
dt num;
14-
int lazy = 0;
14+
ll lazy = 0;
1515
int lch = -1, rch = -1;
1616
} tree[N];
1717
int ptr = 0, root_l, root_r;
18-
implicit_seg_tree(int l, int r) : root_l(l), root_r(r) {
18+
implicit_seg_tree(int l, int r): root_l(l), root_r(r) {
1919
tree[ptr++].num = {0, r - l};
2020
}
21-
void apply(int add, int v) {
21+
void apply(ll add, int v) {
2222
tree[v].num[0] += add;
2323
tree[v].lazy += add;
2424
}
@@ -35,21 +35,21 @@ template <int N> struct implicit_seg_tree {
3535
tree[v].lazy = 0;
3636
}
3737
}
38-
void update(int l, int r, int add) { // [l, r)
38+
void update(int l, int r, ll add) { // [l, r)
3939
update(l, r, add, root_l, root_r, 0);
4040
}
41-
void update(int l, int r, int add, int tl, int tr,
42-
int v) {
41+
void update(int l, int r, ll add, int tl, int tr,
42+
int v) {
4343
if (r <= tl || tr <= l) return;
4444
if (l <= tl && tr <= r) return apply(add, v);
4545
int tm = tl + (tr - tl) / 2;
4646
push(tl, tm, tr, v);
4747
update(l, r, add, tl, tm, tree[v].lch);
4848
update(l, r, add, tm, tr, tree[v].rch);
4949
tree[v].num =
50-
op(tree[tree[v].lch].num, tree[tree[v].rch].num);
50+
op(tree[tree[v].lch].num, tree[tree[v].rch].num);
5151
}
52-
dt query(int l, int r) { // [l, r)
52+
dt query(int l, int r) { // [l, r)
5353
return query(l, r, root_l, root_r, 0);
5454
}
5555
dt query(int l, int r, int tl, int tr, int v) {
@@ -58,6 +58,6 @@ template <int N> struct implicit_seg_tree {
5858
int tm = tl + (tr - tl) / 2;
5959
push(tl, tm, tr, v);
6060
return op(query(l, r, tl, tm, tree[v].lch),
61-
query(l, r, tm, tr, tree[v].rch));
61+
query(l, r, tm, tr, tree[v].rch));
6262
}
6363
};

0 commit comments

Comments
 (0)