結果

問題 No.1761 Sequence Distance
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2021-10-25 09:39:01
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 4,076 ms / 8,000 ms
コード長 482 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 87,280 KB
実行使用メモリ 78,048 KB
最終ジャッジ日時 2023-09-02 00:10:26
合計ジャッジ時間 43,790 ms
ジャッジサーバーID
(参考情報)
judge16 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,184 KB
testcase_01 AC 71 ms
71,412 KB
testcase_02 AC 1,027 ms
77,840 KB
testcase_03 AC 73 ms
75,940 KB
testcase_04 AC 68 ms
71,328 KB
testcase_05 AC 71 ms
75,912 KB
testcase_06 AC 102 ms
77,236 KB
testcase_07 AC 83 ms
76,688 KB
testcase_08 AC 105 ms
77,284 KB
testcase_09 AC 84 ms
76,832 KB
testcase_10 AC 102 ms
77,292 KB
testcase_11 AC 112 ms
77,400 KB
testcase_12 AC 85 ms
76,440 KB
testcase_13 AC 97 ms
77,268 KB
testcase_14 AC 92 ms
77,268 KB
testcase_15 AC 106 ms
76,908 KB
testcase_16 AC 103 ms
77,156 KB
testcase_17 AC 85 ms
76,332 KB
testcase_18 AC 110 ms
76,912 KB
testcase_19 AC 97 ms
77,280 KB
testcase_20 AC 96 ms
77,112 KB
testcase_21 AC 1,140 ms
77,488 KB
testcase_22 AC 171 ms
77,368 KB
testcase_23 AC 3,301 ms
77,908 KB
testcase_24 AC 1,057 ms
77,836 KB
testcase_25 AC 2,872 ms
78,036 KB
testcase_26 AC 2,898 ms
77,708 KB
testcase_27 AC 1,426 ms
77,456 KB
testcase_28 AC 982 ms
77,860 KB
testcase_29 AC 2,359 ms
77,836 KB
testcase_30 AC 741 ms
77,620 KB
testcase_31 AC 1,386 ms
77,904 KB
testcase_32 AC 213 ms
77,428 KB
testcase_33 AC 2,030 ms
77,868 KB
testcase_34 AC 110 ms
77,308 KB
testcase_35 AC 350 ms
77,604 KB
testcase_36 AC 2,368 ms
77,644 KB
testcase_37 AC 454 ms
77,532 KB
testcase_38 AC 671 ms
77,576 KB
testcase_39 AC 1,482 ms
77,752 KB
testcase_40 AC 706 ms
77,696 KB
testcase_41 AC 3,528 ms
78,048 KB
testcase_42 AC 4,050 ms
77,964 KB
testcase_43 AC 4,076 ms
77,936 KB
testcase_44 AC 72 ms
71,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353
n,m=map(int,input().split())
dp=[[0 for i in range(33)] for j in range(m+1)]
dp2=[[0 for i in range(33)] for j in range(m+1)]
dp[0][0]=2
dp[0][1]=2
for i in range(n-1):
  for j in range(0,m+1):
    for k in range(0,32):
      dp2[j+k][k+1]+=dp[j][k]
      dp2[j+k][k]+=dp[j][k]*2
      dp2[j+k][abs(k-1)]+=dp[j][k]
      if j+k+1>m:
        break
  for j in range(0,m+1):
    for k in range(0,32):
        dp[j][k]=dp2[j][k]%mod
        dp2[j][k]=0
print(dp[m][0]%mod)
0