diff options
| author | Noobie99 <noob999noob999@gmail.com> | 2024-02-12 20:16:27 +0100 |
|---|---|---|
| committer | Noobie99 <noob999noob999@gmail.com> | 2024-02-12 20:16:27 +0100 |
| commit | cf757f09058d98a7f6fdf8e5a49894f6aa77e99b (patch) | |
| tree | 7d4f7899784c832606d3c5a8b4e8c31fdadc35b5 | |
| parent | f4dafa64e27e63d8cde5adcfbfa98e2a30fb7504 (diff) | |
fix suffixArray
| -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 54deb84..8b698d2 100644 --- a/string/suffixArray.cpp +++ b/string/suffixArray.cpp @@ -5,7 +5,7 @@ struct SuffixArray { vector<vector<int>> P; SuffixArray(const string& s) : n(sz(s)), SA(n), LCP(n), - P(__lg(n - 1) + 2, vector<int>(n)) { + P(__lg(2 * n - 1) + 1, vector<int>(n)) { P[0].assign(all(s)); iota(all(SA), 0); sort(all(SA), [&](int a, int b) {return s[a] < s[b];}); |
