結果

問題 No.2943 Sigma String of String Score Problem
ユーザー kazuppakazuppa
提出日時 2024-10-17 23:18:13
言語 C++23(gcc13)
(gcc 13.2.0 + boost 1.83.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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,816 KB
testcase_02 AC 1 ms
6,820 KB
testcase_03 AC 104 ms
6,816 KB
testcase_04 AC 6 ms
6,816 KB
testcase_05 AC 49 ms
6,816 KB
testcase_06 AC 4 ms
6,816 KB
testcase_07 AC 13 ms
6,816 KB
testcase_08 AC 89 ms
6,816 KB
testcase_09 AC 44 ms
6,820 KB
testcase_10 AC 13 ms
6,820 KB
testcase_11 AC 3 ms
6,820 KB
testcase_12 AC 18 ms
6,820 KB
testcase_13 AC 7 ms
6,820 KB
testcase_14 AC 5 ms
6,820 KB
testcase_15 AC 8 ms
6,816 KB
testcase_16 AC 6 ms
6,820 KB
testcase_17 AC 3 ms
6,816 KB
testcase_18 AC 58 ms
6,816 KB
testcase_19 AC 30 ms
6,816 KB
testcase_20 AC 21 ms
6,820 KB
testcase_21 AC 59 ms
6,820 KB
testcase_22 AC 117 ms
6,820 KB
testcase_23 AC 119 ms
6,816 KB
testcase_24 AC 119 ms
6,816 KB
testcase_25 AC 88 ms
6,816 KB
testcase_26 AC 105 ms
6,820 KB
testcase_27 AC 119 ms
6,816 KB
testcase_28 AC 1 ms
6,820 KB
testcase_29 AC 2 ms
6,820 KB
testcase_30 AC 4 ms
6,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0