結果
| 問題 |
No.2943 Sigma String of String Score Problem
|
| コンテスト | |
| ユーザー |
detteiuu
|
| 提出日時 | 2024-10-18 22:57:10 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 2,150 ms / 3,000 ms |
| コード長 | 393 bytes |
| コンパイル時間 | 564 ms |
| コンパイル使用メモリ | 82,376 KB |
| 実行使用メモリ | 82,388 KB |
| 最終ジャッジ日時 | 2024-10-18 22:57:58 |
| 合計ジャッジ時間 | 17,819 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
S, T = input().split()
MOD = 998244353
dp = [0]*(len(T)+1)
dp[0] = 1
for i in range(len(S)):
ndp = [0]*(len(T)+1)
for j in range(len(T)+1):
ndp[j] += dp[j]
ndp[j] %= MOD
if j < len(T) and S[i] == T[j]:
ndp[j+1] += dp[j]
ndp[j+1] %= MOD
dp = ndp[:]
ans = dp[-1]
for _ in range(len(S)-len(T)):
ans *= 2
ans %= MOD
print(ans)
detteiuu