結果

問題 No.137 貯金箱の焦り
ユーザー convexineqconvexineq
提出日時 2021-05-14 08:47:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 771 ms / 5,000 ms
コード長 273 bytes
コンパイル時間 380 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 106,368 KB
最終ジャッジ日時 2024-04-08 21:58:23
合計ジャッジ時間 5,463 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
59,644 KB
testcase_01 AC 42 ms
59,640 KB
testcase_02 AC 45 ms
60,156 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 57 ms
62,380 KB
testcase_05 AC 48 ms
59,772 KB
testcase_06 AC 51 ms
62,380 KB
testcase_07 AC 49 ms
59,644 KB
testcase_08 AC 46 ms
59,644 KB
testcase_09 AC 52 ms
62,380 KB
testcase_10 AC 46 ms
59,644 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 771 ms
106,368 KB
testcase_13 AC 101 ms
65,812 KB
testcase_14 AC 420 ms
84,548 KB
testcase_15 AC 372 ms
84,052 KB
testcase_16 AC 354 ms
83,344 KB
testcase_17 AC 149 ms
73,020 KB
testcase_18 AC 351 ms
83,060 KB
testcase_19 AC 399 ms
83,656 KB
testcase_20 AC 44 ms
59,640 KB
testcase_21 AC 211 ms
78,176 KB
testcase_22 AC 69 ms
68,560 KB
testcase_23 AC 66 ms
68,540 KB
testcase_24 AC 124 ms
72,636 KB
testcase_25 AC 259 ms
78,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
*a, = map(int,input().split())
s = sum(a)
MOD = 1234567891
f = [1]
while m:
    f += [0]*s
    for ai in a:
        for i in range(ai,len(f))[::-1]:
            f[i] += f[i-ai]
            f[i] %= MOD
    f = f[m%2::2]
    m //= 2
print(f[0])
0