結果

問題 No.1761 Sequence Distance
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2021-10-24 23:00:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 5,242 ms / 8,000 ms
コード長 610 bytes
コンパイル時間 1,179 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 78,512 KB
最終ジャッジ日時 2023-09-01 23:57:58
合計ジャッジ時間 56,437 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,576 KB
testcase_01 AC 72 ms
71,136 KB
testcase_02 AC 1,368 ms
77,932 KB
testcase_03 AC 75 ms
75,800 KB
testcase_04 AC 73 ms
71,560 KB
testcase_05 AC 76 ms
75,692 KB
testcase_06 AC 114 ms
77,032 KB
testcase_07 AC 92 ms
76,680 KB
testcase_08 AC 114 ms
77,048 KB
testcase_09 AC 93 ms
76,732 KB
testcase_10 AC 114 ms
76,896 KB
testcase_11 AC 125 ms
76,892 KB
testcase_12 AC 96 ms
76,744 KB
testcase_13 AC 107 ms
76,892 KB
testcase_14 AC 99 ms
77,368 KB
testcase_15 AC 113 ms
77,152 KB
testcase_16 AC 110 ms
77,188 KB
testcase_17 AC 94 ms
76,808 KB
testcase_18 AC 123 ms
77,248 KB
testcase_19 AC 105 ms
77,372 KB
testcase_20 AC 107 ms
77,256 KB
testcase_21 AC 1,468 ms
77,280 KB
testcase_22 AC 200 ms
77,280 KB
testcase_23 AC 4,406 ms
78,184 KB
testcase_24 AC 1,400 ms
78,208 KB
testcase_25 AC 3,730 ms
78,172 KB
testcase_26 AC 3,851 ms
78,512 KB
testcase_27 AC 1,851 ms
77,652 KB
testcase_28 AC 1,273 ms
77,884 KB
testcase_29 AC 3,128 ms
78,068 KB
testcase_30 AC 933 ms
77,604 KB
testcase_31 AC 1,812 ms
78,100 KB
testcase_32 AC 254 ms
77,176 KB
testcase_33 AC 2,692 ms
77,880 KB
testcase_34 AC 118 ms
77,056 KB
testcase_35 AC 425 ms
77,396 KB
testcase_36 AC 3,081 ms
77,832 KB
testcase_37 AC 566 ms
77,568 KB
testcase_38 AC 861 ms
77,644 KB
testcase_39 AC 1,922 ms
77,932 KB
testcase_40 AC 897 ms
77,184 KB
testcase_41 AC 4,738 ms
78,448 KB
testcase_42 AC 5,225 ms
77,968 KB
testcase_43 AC 5,242 ms
78,216 KB
testcase_44 AC 73 ms
71,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=998244353
n,m=map(int,input().split())
dp=[[0 for i in range(46)] for j in range(m+1)]
dp2=[[0 for i in range(46)] 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,45):
      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
  if i%4==0:
    for j in range(0,m+1):
      for k in range(0,45):
        dp[j][k]=dp2[j][k]%mod
        dp2[j][k]=0
  else:
    for j in range(0,m+1):
      for k in range(0,45):
        dp[j][k]=dp2[j][k]
        dp2[j][k]=0 
print(dp[m][0]%mod)
0