From aad305dd033683db1584549706dbd123954eceb9 Mon Sep 17 00:00:00 2001 From: Zengtudor Date: Sun, 6 Oct 2024 09:28:39 +0800 Subject: [PATCH] update --- src/U206625/U206625_myself.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/U206625/U206625_myself.cpp b/src/U206625/U206625_myself.cpp index e69de29..d8b157e 100644 --- a/src/U206625/U206625_myself.cpp +++ b/src/U206625/U206625_myself.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +using std::cin, std::cout, std::string, std::for_each_n; +typedef unsigned long long ull; + +static const size_t MOD {998244353}, MAX_N {300000+5}; +static string s; +static size_t left_dp[MAX_N], last_left[MAX_N], unused_left_num, ans; +static ull stk[MAX_N]; + +int main(){ + cin>>s; + + for(size_t i {0};i0){ + last_left[i] = stk[--unused_left_num]; + cout<<(last_left[i]-1)<<"--\n"; + left_dp[i] = (left_dp[last_left[i]-1] + last_left[i]+1) % MOD; + ans = (ans + left_dp[i] * (s.size() - i)) % MOD ; + } + } + cout<