From e17b83f199919973473f4e67b5125acab1b8b62c Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sat, 5 Oct 2024 19:50:29 +0800 Subject: [PATCH] update --- src/U206625/U206625.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/U206625/U206625.cpp b/src/U206625/U206625.cpp index dc2c8bb..53b3c5a 100644 --- a/src/U206625/U206625.cpp +++ b/src/U206625/U206625.cpp @@ -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';