diff options
| author | Noobie99 <noob999noob999@gmail.com> | 2023-03-29 12:23:14 +0200 |
|---|---|---|
| committer | Noobie99 <noob999noob999@gmail.com> | 2023-03-29 12:23:14 +0200 |
| commit | 107d427b32e3b60072a9008dc19be37b0a2b3ce1 (patch) | |
| tree | b847e7e8f38490c513d56164ee66c48293592782 /string/suffixArray.cpp | |
| parent | 53abe93a51539eda9794351417c4573a305a40f2 (diff) | |
fix suffix Array when |s| = 1, reduced (useless?) memory usage
Diffstat (limited to 'string/suffixArray.cpp')
| -rw-r--r-- | string/suffixArray.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/string/suffixArray.cpp b/string/suffixArray.cpp index 720148c..2423af7 100644 --- a/string/suffixArray.cpp +++ b/string/suffixArray.cpp @@ -5,7 +5,7 @@ struct SuffixArray { vector<pair<pair<int, int>, int>> L; SuffixArray(const string& s) : n(sz(s)), SA(n), LCP(n), L(n) { - P.assign(__lg(n)*4-2, vector<int>(n)); + P.assign(__lg(n)+2, vector<int>(n)); for (int i = 0; i < n; i++) P[0][i] = s[i]; for (step = 1, count = 1; count < n; step++, count *= 2) { for (int i = 0; i < n; i++) |
