結果
問題 |
No.1782 ManyCoins
|
ユーザー |
![]() |
提出日時 | 2021-12-12 19:01:33 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 964 bytes |
コンパイル時間 | 215 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 113,280 KB |
最終ジャッジ日時 | 2024-07-21 06:36:39 |
合計ジャッジ時間 | 10,697 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 23 |
ソースコード
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()