結果

問題 No.2943 Sigma String of String Score Problem
ユーザー Today03Today03
提出日時 2024-10-18 22:33:03
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 669 bytes
コンパイル時間 3,182 ms
コンパイル使用メモリ 252,984 KB
実行使用メモリ 397,952 KB
最終ジャッジ日時 2024-10-18 22:52:25
合計ジャッジ時間 9,915 ms
ジャッジサーバーID
(参考情報)
judge5 / judge6
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 1 ms
6,944 KB
testcase_03 MLE -
testcase_04 AC 17 ms
15,104 KB
testcase_05 MLE -
testcase_06 AC 13 ms
11,904 KB
testcase_07 AC 54 ms
41,344 KB
testcase_08 MLE -
testcase_09 MLE -
testcase_10 AC 56 ms
43,648 KB
testcase_11 AC 13 ms
10,368 KB
testcase_12 AC 84 ms
70,784 KB
testcase_13 AC 29 ms
24,192 KB
testcase_14 AC 20 ms
16,000 KB
testcase_15 AC 34 ms
24,960 KB
testcase_16 AC 23 ms
16,896 KB
testcase_17 AC 8 ms
7,040 KB
testcase_18 MLE -
testcase_19 AC 133 ms
103,808 KB
testcase_20 AC 84 ms
63,872 KB
testcase_21 MLE -
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 MLE -
testcase_27 MLE -
testcase_28 AC 2 ms
6,944 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9 + 10;
const ll INFL = 4e18;

#include <atcoder/modint>
using mint = atcoder::modint998244353;

int main() {
    string S, T;
    cin >> S >> T;
    int N = ssize(S), M = ssize(T);

    vector<vector<mint>> dp(N + 1, vector<mint>(M + 1));
    dp[0][0] = 1;
    for (int i = 0; i < N; i++) {
        for (int j = 0; j <= M; j++) {
            dp[i + 1][j] += dp[i][j];
            if (S[i] == T[j] && j < M) {
                dp[i + 1][j + 1] += dp[i][j];
            }
        }
    }

    mint ans = dp.back().back();
    ans *= mint(2).pow(N - M);
    cout << ans.val() << endl;
}
0