diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 21:17:29 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-16 21:17:29 +0100 |
| commit | 1880ccb6d85c6eb79e724593457877bab431951c (patch) | |
| tree | 23eddd5bd0b29b3024e170a5ef9023eda9226ab5 /test/string/manacher.cpp | |
| parent | e95f59debd69ee7d45d5c966ce466d23264e1c3c (diff) | |
get rid of all() and sz()
Diffstat (limited to 'test/string/manacher.cpp')
| -rw-r--r-- | test/string/manacher.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/string/manacher.cpp b/test/string/manacher.cpp index 503d181..803154b 100644 --- a/test/string/manacher.cpp +++ b/test/string/manacher.cpp @@ -2,16 +2,16 @@ #include <string/manacher.cpp> vector<int> naive(string_view s) { - vector<int> res(2 * sz(s) + 1); - for (int i = 0; i < sz(s); i++) { //odd palindromes + vector<int> res(2 * ssize(s) + 1); + for (int i = 0; i < ssize(s); i++) { //odd palindromes int j = 2*i+1; - while (i+res[j] < sz(s) && i-res[j] >= 0 && s[i-res[j]] == s[i+res[j]]) res[j]++; + while (i+res[j] < ssize(s) && i-res[j] >= 0 && s[i-res[j]] == s[i+res[j]]) res[j]++; res[j]*=2; res[j]--; } - for (int i = 0; i <= sz(s); i++) { //even palindromes + for (int i = 0; i <= ssize(s); i++) { //even palindromes int j = 2*i; - while (i+res[j] < sz(s) && i-res[j]-1 >= 0 && s[i-res[j]-1] == s[i+res[j]]) res[j]++; + while (i+res[j] < ssize(s) && i-res[j]-1 >= 0 && s[i-res[j]-1] == s[i+res[j]]) res[j]++; res[j] *= 2; } return res; |
