diff --git a/src/U206625/U206625_myself.cpp b/src/U206625/U206625_myself.cpp index d8b157e..f9d644b 100644 --- a/src/U206625/U206625_myself.cpp +++ b/src/U206625/U206625_myself.cpp @@ -1,26 +1,74 @@ -#include #include +#include #include +#include -using std::cin, std::cout, std::string, std::for_each_n; +using std::cin, std::cout, std::string; typedef unsigned long long ull; +template +struct Array{ + #ifdef NDEBUG + #define NDB_NOEXCEPT noexcept + #else + #define NDB_NOEXCEPT + #endif + + T& operator[](const size_t n)NDB_NOEXCEPT{ + #ifndef NDEBUG + if(n>=size){ + std::ostringstream err_oss; + err_oss<<"\n[array_size]: "<=size){ + std::ostringstream err_oss; + err_oss<<"[array_size]: "< left_dp, last_left; +static Array stk; 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 ; + left_dp[i] = (left_dp[last_left[i]-1] + last_left[i]) % MOD; + ans = (ans + left_dp[i] * (s.size() - i+1)) % MOD ; } } cout<