update
This commit is contained in:
parent
b93eef8e0e
commit
e17b83f199
@ -9,7 +9,7 @@ constexpr auto range = std::ranges::views::iota;
|
||||
|
||||
constexpr size_t MAX_N{(size_t)3e5 + 5}, MOD{998244353};
|
||||
string s;
|
||||
ull stk[MAX_N], left_num[MAX_N], g[MAX_N], ans;
|
||||
ull stk[MAX_N], left_num[MAX_N], dp[MAX_N], ans;
|
||||
size_t stk_size;
|
||||
|
||||
int main() {
|
||||
@ -19,8 +19,8 @@ int main() {
|
||||
stk[stk_size++] = i + 1;
|
||||
} else if (stk_size > 0) {
|
||||
left_num[i] = stk[--stk_size];
|
||||
g[i] = (g[left_num[i] - 2] + left_num[i]) % MOD;
|
||||
ans = (ans + g[i] * (s.size() - i)) % MOD;
|
||||
dp[i] = (dp[left_num[i] - 2] + left_num[i]) % MOD;
|
||||
ans = (ans + dp[i] * (s.size() - i)) % MOD;
|
||||
}
|
||||
}
|
||||
cout << ans << '\n';
|
||||
|
Loading…
Reference in New Issue
Block a user