結果

問題 No.1761 Sequence Distance
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2021-10-24 23:13:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 4,509 ms / 8,000 ms
コード長 618 bytes
コンパイル時間 392 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 78,556 KB
最終ジャッジ日時 2023-09-02 00:06:02
合計ジャッジ時間 46,250 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,432 KB
testcase_01 AC 72 ms
71,544 KB
testcase_02 AC 1,177 ms
78,364 KB
testcase_03 AC 75 ms
75,756 KB
testcase_04 AC 72 ms
71,600 KB
testcase_05 AC 75 ms
75,588 KB
testcase_06 AC 105 ms
77,616 KB
testcase_07 AC 90 ms
76,788 KB
testcase_08 AC 101 ms
76,848 KB
testcase_09 AC 90 ms
76,724 KB
testcase_10 AC 105 ms
77,384 KB
testcase_11 AC 111 ms
77,576 KB
testcase_12 AC 96 ms
76,864 KB
testcase_13 AC 102 ms
77,452 KB
testcase_14 AC 91 ms
76,748 KB
testcase_15 AC 106 ms
77,192 KB
testcase_16 AC 102 ms
76,692 KB
testcase_17 AC 92 ms
77,020 KB
testcase_18 AC 113 ms
77,428 KB
testcase_19 AC 98 ms
76,604 KB
testcase_20 AC 100 ms
77,360 KB
testcase_21 AC 1,264 ms
77,824 KB
testcase_22 AC 162 ms
77,584 KB
testcase_23 AC 3,712 ms
78,320 KB
testcase_24 AC 1,161 ms
78,328 KB
testcase_25 AC 3,073 ms
78,304 KB
testcase_26 AC 3,166 ms
78,204 KB
testcase_27 AC 1,275 ms
77,696 KB
testcase_28 AC 1,011 ms
78,084 KB
testcase_29 AC 2,609 ms
78,308 KB
testcase_30 AC 650 ms
77,744 KB
testcase_31 AC 1,486 ms
78,312 KB
testcase_32 AC 197 ms
77,564 KB
testcase_33 AC 2,027 ms
78,076 KB
testcase_34 AC 112 ms
77,616 KB
testcase_35 AC 302 ms
77,360 KB
testcase_36 AC 2,474 ms
78,088 KB
testcase_37 AC 405 ms
77,524 KB
testcase_38 AC 637 ms
77,884 KB
testcase_39 AC 1,466 ms
77,748 KB
testcase_40 AC 600 ms
77,456 KB
testcase_41 AC 4,034 ms
78,556 KB
testcase_42 AC 4,488 ms
78,360 KB
testcase_43 AC 4,509 ms
78,444 KB
testcase_44 AC 72 ms
71,508 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*(k+1)/2+1>m:
        break
  if i%6==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