結果
問題 | No.2964 Obstruction Bingo |
ユーザー |
![]() |
提出日時 | 2024-11-16 17:24:00 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,067 bytes |
コンパイル時間 | 380 ms |
コンパイル使用メモリ | 81,836 KB |
実行使用メモリ | 80,532 KB |
最終ジャッジ日時 | 2024-11-16 17:24:46 |
合計ジャッジ時間 | 45,614 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 37 ms
51,876 KB |
testcase_01 | AC | 39 ms
53,136 KB |
testcase_02 | AC | 60 ms
68,256 KB |
testcase_03 | AC | 39 ms
53,944 KB |
testcase_04 | AC | 52 ms
63,208 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | WA | - |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | AC | 68 ms
71,412 KB |
testcase_47 | AC | 67 ms
70,820 KB |
testcase_48 | AC | 88 ms
76,236 KB |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | WA | - |
ソースコード
l,k = map(int,input().split()) s = [ord(v)-97 for v in input()] t = [ord(v)-97 for v in input()] a = list(map(int,input().split())) dp = [[0]*2*l for _ in range(2*l)] dp[0][0] = 1; x = y = 0; z = 998244353 n = sum(a); d = pow(n,-1,z) for _ in range(k): eq = [[0]*2*l for _ in range(2*l)] for i in range(2*l): for j in range(2*l): if i>=l<=j or abs(i-j)>=l or dp[i][j]==0: continue for v,c in enumerate(a): p = dp[i][j]*c%z*d%z if s[i%l]==t[j%l]==v: if i+1>=l<=j+1: eq[(i+1)%l][(j+1)%l] += p else: eq[i+1][j+1] += p elif s[i%l]==v: if i+1-j==l: x += p elif i+1>=l<=j: eq[(i+1)%l][j] += p else: eq[i+1][j] += p elif t[j%l]==v: if j+1-i==l: y += p elif i>=l<=j+1: eq[i][(j+1)%l] += p else: eq[i][j+1] += p else: eq[i][j] += p dp = [[eqij%z for eqij in eqi] for eqi in eq] print(x%z,y%z)