結果

問題 No.2783 4-33 Easy
ユーザー miho-4miho-4
提出日時 2024-06-14 23:15:35
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 616 bytes
コンパイル時間 390 ms
コンパイル使用メモリ 82,444 KB
実行使用メモリ 76,844 KB
最終ジャッジ日時 2024-06-14 23:15:40
合計ジャッジ時間 4,976 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
64,948 KB
testcase_01 AC 52 ms
63,312 KB
testcase_02 AC 57 ms
66,252 KB
testcase_03 AC 57 ms
66,740 KB
testcase_04 AC 91 ms
76,244 KB
testcase_05 AC 118 ms
76,472 KB
testcase_06 AC 118 ms
76,244 KB
testcase_07 AC 122 ms
76,088 KB
testcase_08 AC 119 ms
76,504 KB
testcase_09 WA -
testcase_10 AC 119 ms
76,324 KB
testcase_11 WA -
testcase_12 AC 115 ms
75,944 KB
testcase_13 AC 112 ms
76,304 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 116 ms
76,088 KB
testcase_17 WA -
testcase_18 AC 115 ms
76,200 KB
testcase_19 AC 114 ms
76,568 KB
testcase_20 AC 115 ms
76,208 KB
testcase_21 AC 116 ms
76,000 KB
testcase_22 AC 113 ms
76,284 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 118 ms
76,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353

n=int(input())
A=list(input().split())
B=list(input().split())

dp=[[[0]*(9) for _ in range(34+1)] for _ in range(4+1)]
dp[0][0][0]=1
ans=0
X=[]
for i in range(n):
  a,b=A[i],B[i]
  if "X" in b:
    X.append((int(a),int("0"+b[:-1])))
    continue
  a,b=int(a),int(b)
  for ai in range(4+1)[::-1]:
    for bi in range(33+1)[::-1]:
      for k in range(8)[::-1]:
        if 0<=ai-a and 0<=bi-b:
          dp[ai][bi][k+1]+=dp[ai-a][bi-b][k]
          dp[ai][bi][k+1]%=mod


for a,b in X:
  if 0<=4-a and 0<=33-b:
    if b!=0 and b<28:
      continue
    ans+=dp[4-a][33-b][8]
    ans%=mod
    
print(ans)
0