結果

問題 No.137 貯金箱の焦り
ユーザー とりゐとりゐ
提出日時 2022-08-06 11:01:10
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 3,128 ms / 5,000 ms
コード長 299 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 276,960 KB
最終ジャッジ日時 2023-10-14 12:21:08
合計ジャッジ時間 13,773 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
75,712 KB
testcase_01 AC 77 ms
75,668 KB
testcase_02 AC 78 ms
75,944 KB
testcase_03 AC 68 ms
71,148 KB
testcase_04 AC 85 ms
76,208 KB
testcase_05 AC 81 ms
75,876 KB
testcase_06 AC 82 ms
76,020 KB
testcase_07 AC 81 ms
75,644 KB
testcase_08 AC 81 ms
75,500 KB
testcase_09 AC 82 ms
75,980 KB
testcase_10 AC 81 ms
75,660 KB
testcase_11 AC 69 ms
70,668 KB
testcase_12 AC 3,128 ms
276,960 KB
testcase_13 AC 285 ms
101,036 KB
testcase_14 AC 1,576 ms
265,320 KB
testcase_15 AC 1,055 ms
207,908 KB
testcase_16 AC 1,016 ms
204,240 KB
testcase_17 AC 154 ms
76,248 KB
testcase_18 AC 885 ms
175,300 KB
testcase_19 AC 1,442 ms
267,108 KB
testcase_20 AC 80 ms
75,820 KB
testcase_21 AC 205 ms
76,224 KB
testcase_22 AC 98 ms
76,468 KB
testcase_23 AC 97 ms
76,216 KB
testcase_24 AC 142 ms
76,040 KB
testcase_25 AC 495 ms
108,884 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod=1234567891
n,m=map(int,input().split())
a=list(map(int,input().split()))

N=2*sum(a)+10
dp=[0]*N
dp[0]=1

while m:
  for i in a:
    for j in range(N-i-1,-1,-1):
      dp[i+j]+=dp[j]
  
  ndp=[0]*N
  for i in range(N):
    if i%2==m%2:
      ndp[i//2]=dp[i]%mod
  
  dp=ndp
  m//=2

print(dp[0])
0