結果
問題 | No.2943 Sigma String of String Score Problem |
ユーザー |
![]() |
提出日時 | 2024-10-17 23:18:13 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 119 ms / 3,000 ms |
コード長 | 501 bytes |
コンパイル時間 | 6,545 ms |
コンパイル使用メモリ | 336,580 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-17 23:18:23 |
合計ジャッジ時間 | 8,288 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using mint=modint998244353; int main(){ string s, t; cin >> s >> t; int n = s.size(), m = t.size(); vector<mint> dp(m + 1), ara(m + 1); mint g = 2; dp[0] = 1, ara[0] = 1; for(int i = 0; i < n; i++) { for(int j = 0; j < m; j++) if(s[i] == t[j]) ara[j + 1] += dp[j]; dp = ara; } cout << (dp[m] * g.pow(n - m)).val() << endl; }