結果

問題 No.1782 ManyCoins
ユーザー tamatotamato
提出日時 2021-12-12 19:01:33
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 964 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 87,392 KB
実行使用メモリ 114,856 KB
最終ジャッジ日時 2023-09-28 11:57:50
合計ジャッジ時間 16,778 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,968 KB
testcase_01 AC 112 ms
77,520 KB
testcase_02 AC 97 ms
71,960 KB
testcase_03 AC 94 ms
71,836 KB
testcase_04 AC 96 ms
72,040 KB
testcase_05 WA -
testcase_06 AC 97 ms
72,012 KB
testcase_07 AC 95 ms
71,664 KB
testcase_08 AC 98 ms
71,856 KB
testcase_09 AC 97 ms
72,016 KB
testcase_10 AC 97 ms
72,200 KB
testcase_11 AC 96 ms
71,796 KB
testcase_12 AC 95 ms
71,884 KB
testcase_13 WA -
testcase_14 AC 775 ms
114,416 KB
testcase_15 AC 396 ms
102,788 KB
testcase_16 AC 530 ms
108,792 KB
testcase_17 AC 757 ms
112,536 KB
testcase_18 AC 439 ms
111,024 KB
testcase_19 WA -
testcase_20 AC 701 ms
107,888 KB
testcase_21 AC 865 ms
114,856 KB
testcase_22 AC 1,209 ms
111,584 KB
testcase_23 AC 1,125 ms
111,276 KB
testcase_24 WA -
testcase_25 AC 718 ms
112,156 KB
testcase_26 AC 345 ms
99,524 KB
testcase_27 AC 1,165 ms
114,484 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 234 ms
94,328 KB
testcase_33 AC 235 ms
94,124 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 140 ms
78,904 KB
testcase_48 AC 94 ms
72,032 KB
testcase_49 WA -
testcase_50 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9
inf = 10 ** 18


def main():
    import sys
    from collections import deque
    input = sys.stdin.readline

    N, L = map(int, input().split())
    W = list(map(int, input().split()))

    W.sort()
    w_max = W[-1]

    seen = [inf] * w_max
    que = deque([(0, 0)])
    seen[0] = 0
    while que:
        v, d = que.popleft()
        if d != seen[v]:
            continue
        for w in W[:-1]:
            u = v + w
            if u < w_max:
                if d < seen[u]:
                    seen[u] = d
                    que.appendleft((u, d))
            else:
                u -= w_max
                if d + 1 < seen[u]:
                    seen[u] = d + 1
                    que.append((u, d + 1))

    ans = 0
    for i in range(w_max):
        add = L // w_max
        if L % w_max > i:
            add += 1
        add -= seen[i]
        ans += max(0, add)
    print(ans)


if __name__ == '__main__':
    main()
0