summaryrefslogtreecommitdiff
path: root/content/string/ahoCorasick.cpp
diff options
context:
space:
mode:
authorGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 21:17:29 +0100
committerGloria Mundi <gloria@gloria-mundi.eu>2024-11-16 21:17:29 +0100
commit1880ccb6d85c6eb79e724593457877bab431951c (patch)
tree23eddd5bd0b29b3024e170a5ef9023eda9226ab5 /content/string/ahoCorasick.cpp
parente95f59debd69ee7d45d5c966ce466d23264e1c3c (diff)
get rid of all() and sz()
Diffstat (limited to 'content/string/ahoCorasick.cpp')
-rw-r--r--content/string/ahoCorasick.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/content/string/ahoCorasick.cpp b/content/string/ahoCorasick.cpp
index c65e20a..d738961 100644
--- a/content/string/ahoCorasick.cpp
+++ b/content/string/ahoCorasick.cpp
@@ -4,7 +4,8 @@ struct AhoCorasick {
int suffix = 0, ch, cnt = 0;
array<int, ALPHABET_SIZE> nxt = {};
- vert(int p, int c): suffix(-p), ch(c) { fill(all(nxt), -1); }
+ vert(int p, int c):
+ suffix(-p), ch(c) { ranges::fill(nxt, -1); }
};
vector<vert> aho = {{0, -1}};
@@ -13,7 +14,7 @@ struct AhoCorasick {
for (auto c : s) {
int idx = c - OFFSET;
if (aho[v].nxt[idx] == -1) {
- aho[v].nxt[idx] = sz(aho);
+ aho[v].nxt[idx] = ssize(aho);
aho.emplace_back(v, idx);
}
v = aho[v].nxt[idx];
@@ -37,9 +38,9 @@ struct AhoCorasick {
vector<vector<int>> adj;
vector<ll> dp;
void buildGraph() {
- adj.resize(sz(aho));
- dp.assign(sz(aho), 0);
- for (int i = 1; i < sz(aho); i++) {
+ adj.resize(ssize(aho));
+ dp.assign(ssize(aho), 0);
+ for (int i = 1; i < ssize(aho); i++) {
adj[getSuffix(i)].push_back(i);
}}