Update trees/segtree_generic.cc
Signed-off-by: subcrip <contact@subc.rip>
This commit is contained in:
parent
52bc203f6a
commit
4a2403a1dc
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
template<typename Addable_Info_t, typename Tag_t, typename Sequence = std::vector<Addable_Info_t>> class segtree {
|
template<typename Addable_Info_t, typename Tag_t, typename Sequence = std::vector<Addable_Info_t>> class segtree {
|
||||||
private:
|
private:
|
||||||
using size_type = uint64_t;
|
using size_type = uint64_t;
|
||||||
|
@ -27,7 +26,7 @@ private:
|
||||||
if (s != t) push(p, m - s + 1, t - m);
|
if (s != t) push(p, m - s + 1, t - m);
|
||||||
if (x <= m) set(s, m, p * 2, x, c);
|
if (x <= m) set(s, m, p * 2, x, c);
|
||||||
else set(m + 1, t, p * 2 + 1, x, c);
|
else set(m + 1, t, p * 2 + 1, x, c);
|
||||||
d[p] = d[p * 2] + d[p * 2 + 1];
|
pull(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void range_apply(size_type s, size_type t, size_type p, size_type l, size_type r, const tag_type& c) {
|
void range_apply(size_type s, size_type t, size_type p, size_type l, size_type r, const tag_type& c) {
|
||||||
|
@ -123,4 +122,3 @@ struct Info {
|
||||||
Info operator+(const Info &a, const Info &b) {
|
Info operator+(const Info &a, const Info &b) {
|
||||||
return {a.val + b.val};
|
return {a.val + b.val};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue