結果

問題 No.2943 Sigma String of String Score Problem
ユーザー lif4635lif4635
提出日時 2024-10-18 21:51:36
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,099 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 82,152 KB
実行使用メモリ 848,524 KB
最終ジャッジ日時 2024-10-18 22:41:20
合計ジャッジ時間 14,388 ms
ジャッジサーバーID
(参考情報)
judge / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
53,500 KB
testcase_01 AC 36 ms
52,820 KB
testcase_02 AC 38 ms
52,340 KB
testcase_03 MLE -
testcase_04 AC 118 ms
99,080 KB
testcase_05 MLE -
testcase_06 AC 101 ms
93,008 KB
testcase_07 MLE -
testcase_08 MLE -
testcase_09 MLE -
testcase_10 MLE -
testcase_11 AC 92 ms
90,212 KB
testcase_12 MLE -
testcase_13 AC 171 ms
118,236 KB
testcase_14 AC 135 ms
101,316 KB
testcase_15 AC 218 ms
119,720 KB
testcase_16 AC 164 ms
103,152 KB
testcase_17 AC 79 ms
83,568 KB
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 MLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

def II() -> int : return int(input())
def MI() -> int : return map(int, input().split())
def TI() -> tuple[int] : return tuple(MI())
def LI() -> list[int] : return list(MI())
class fenwick_tree():
    n=1
    data=[0 for i in range(n)]
    def __init__(self,N):
        self.n=N
        self.data=[0 for i in range(N)]
    def add(self,p,x):
        assert 0<=p<self.n,"0<=p<n,p={0},n={1}".format(p,self.n)
        p+=1
        while(p<=self.n):
            self.data[p-1]+=x
            p+=p& -p
    def sum(self,l,r):
        assert (0<=l and l<=r and r<=self.n),"0<=l<=r<=n,l={0},r={1},n={2}".format(l,r,self.n)
        return self.sum0(r)-self.sum0(l)
    def sum0(self,r):
        s=0
        while(r>0):
            s+=self.data[r-1]
            r-=r&-r
        return s

mod = 998244353
s,t = input().split()

n = len(s)
l = len(t)
dp = [[0]*(l+1) for i in range(n+1)]
dp[0][0] = 1

for i in range(n):
    for j in range(l+1):
        if j != l and s[i] == t[j]:
            dp[i+1][j+1] += dp[i][j]%mod
        dp[i+1][j] += dp[i][j]*2%mod
            
# print(dp)
print(dp[-1][-1]%mod)
    
0