Skip to content

Commit 85b5657

Browse files
committed
another fix
1 parent d2c7a16 commit 85b5657

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

library/strings/string_hash.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
//! @time O(n + q)
1212
//! @space O(n)
1313
using hsh = array<ll, 2>;
14-
constexpr hsh mod = {ll(1e9 + 7), ll(1e9 + 9)};
14+
constexpr hsh md = {ll(1e9 + 7), ll(1e9 + 9)};
1515
const ll base = 239017;
1616
struct str_hash {
1717
vector<hsh> ha, pw;
1818
str_hash(const auto& s): ha(sz(s) + 1), pw(ha) {
1919
pw[0] = {1, 1};
2020
rep(i, 0, sz(s)) rep(j, 0, 2) {
21-
pw[i + 1][j] = pw[i][j] * base % mod[j];
22-
ha[i + 1][j] = (ha[i][j] * base + s[i] + 1) % mod[j];
21+
pw[i + 1][j] = pw[i][j] * base % md[j];
22+
ha[i + 1][j] = (ha[i][j] * base + s[i] + 1) % md[j];
2323
}
2424
}
2525
hsh subarray(int l, int r) { // [l, r)
2626
hsh res;
2727
rep(j, 0, 2) {
28-
res[j] = ha[r][j] - ha[l][j] * pw[r - l][j] % mod[j];
29-
if (res[j] < 0) res[j] += mod[j];
28+
res[j] = ha[r][j] - ha[l][j] * pw[r - l][j] % md[j];
29+
if (res[j] < 0) res[j] += md[j];
3030
}
3131
return res;
3232
}

0 commit comments

Comments
 (0)