結果
| 問題 | No.1015 おつりは要らないです |
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-07-30 03:45:43 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 390 ms / 2,000 ms |
| コード長 | 542 bytes |
| 記録 | |
| コンパイル時間 | 300 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 21,824 KB |
| 最終ジャッジ日時 | 2024-11-18 07:24:54 |
| 合計ジャッジ時間 | 8,741 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()))
numbers = [Z, Y, X]
bills = [10000, 5000, 1000]
A = [-n for n in A]
heapify(A)
for i in range(3):
n = numbers[i]
b = bills[i]
while A:
if n == 0:
break
x = -heappop(A)
if x >= b:
t = min(x // b, n)
n -= t
x -= b * t
heappush(A, -x)
else:
n -= 1
if len(A) == 0:
print('Yes')
else:
print('No')
c-yan