結果

問題 No.1782 ManyCoins
ユーザー tamatotamato
提出日時 2021-12-12 18:56:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,067 bytes
コンパイル時間 279 ms
コンパイル使用メモリ 87,636 KB
実行使用メモリ 685,856 KB
最終ジャッジ日時 2023-09-28 11:51:51
合計ジャッジ時間 7,581 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
72,284 KB
testcase_01 AC 119 ms
77,900 KB
testcase_02 AC 98 ms
71,916 KB
testcase_03 AC 95 ms
72,020 KB
testcase_04 AC 97 ms
71,728 KB
testcase_05 WA -
testcase_06 AC 96 ms
71,736 KB
testcase_07 AC 96 ms
72,108 KB
testcase_08 AC 93 ms
71,968 KB
testcase_09 AC 95 ms
71,864 KB
testcase_10 AC 96 ms
71,644 KB
testcase_11 AC 95 ms
71,856 KB
testcase_12 AC 97 ms
71,924 KB
testcase_13 WA -
testcase_14 MLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


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]
    adj = [[] for _ in range(w_max)]
    for i in range(w_max):
        for w in W[:-1]:
            i_new = i + w
            if i_new < w_max:
                adj[i].append((i_new, 0))
            else:
                adj[i].append((i_new - w_max, 1))

    seen = [-1] * w_max
    que = deque([(0, 0)])
    while que:
        v, d = que.popleft()
        if seen[v] == -1:
            seen[v] = d
            for u, c in adj[v]:
                if seen[u] == -1:
                    if c == 0:
                        que.appendleft((u, d))
                    else:
                        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