Skip to content

Commit 1f8a504

Browse files
committed
add
2 parents a7a5255 + b725a10 commit 1f8a504

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

‎datastructure/starryskytree.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ template<class N>
22
struct SegTree {
33
int lg, sz;
44
vector<N> n;
5+
SegTree() {}
56
SegTree(int sz) {
67
assert(sz >= 1);
78
lg = bsr(uint(2*sz-1));
@@ -15,6 +16,14 @@ struct SegTree {
1516
n[i] = N(n[2*i], n[2*i+1]);
1617
}
1718
}
19+
void all_update() {
20+
for (int i = 1; i <= sz-1; i++) {
21+
n[i].push();
22+
}
23+
for (int i = sz-1; i >= 1; i--) {
24+
n[i].update(n[2*i], n[2*i+1]);
25+
}
26+
}
1827
template<class Q>
1928
Q single(int idx, Q q) {
2029
if (idx < 0 || sz <= idx) return q;
@@ -48,6 +57,11 @@ struct SegTree {
4857
if (a < sz && 0 < b) query(a, b, q, 1, sz);
4958
return q;
5059
}
60+
struct NodeQuery {
61+
N n;
62+
static constexpr bool update() { return false; }
63+
void operator+=(N &r) { N nn; nn.update(n, r); n = nn; }
64+
};
5165
};
5266

5367
struct Node {

‎string/sawrapper.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,10 @@ array<int, 2> find(SA<Str> &sa, string t) {
2828
ans[1] = r;
2929
return ans;
3030
}
31+
32+
template<class Str>
33+
int cp_len(SA<Str> sa, SparseTable<int> &st, int l, int r) {
34+
if (l == r) return int(sa.s.size()) - l;
35+
int li = sa.rsa[l], ri = sa.rsa[r];
36+
return st.query(min(li, ri), max(li, ri), TEN(9));
37+
}

0 commit comments

Comments
 (0)