結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
![]() |
提出日時 | 2020-04-05 03:56:42 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 418 ms / 2,000 ms |
コード長 | 542 bytes |
コンパイル時間 | 300 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,692 KB |
最終ジャッジ日時 | 2024-11-18 05:46:14 |
合計ジャッジ時間 | 9,230 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
from heapq import heapify, heappop, heappush N, X, Y, Z = map(int, input().split()) A = list(map(int, input().split())) amounts = [Z, Y, X] bills = [10000, 5000, 1000] A = [-a for a in A] heapify(A) for i in range(3): a = amounts[i] b = bills[i] while A: if a == 0: break x = -heappop(A) if x >= b: t = min(x // b, a) a -= t x -= b * t heappush(A, -x) else: a -= 1 if len(A) == 0: print('Yes') else: print('No')