結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
c-yan
|
| 提出日時 | 2020-04-03 23:17:43 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 344 ms / 2,000 ms |
| コード長 | 760 bytes |
| コンパイル時間 | 129 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 21,808 KB |
| 最終ジャッジ日時 | 2024-11-17 23:16:24 |
| 合計ジャッジ時間 | 8,729 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()))
A = [-a for a in A]
heapify(A)
while A:
if Z == 0:
break
x = -heappop(A)
if x >= 10000:
t = min(x // 10000, Z)
Z -= t
x -= 10000 * t
heappush(A, -x)
else:
Z -= 1
while A:
if Y == 0:
break
x = -heappop(A)
if x >= 5000:
t = min(x // 5000, Y)
Y -= t
x -= 5000 * t
heappush(A, -x)
else:
Y -= 1
while A:
if X == 0:
break
x = -heappop(A)
t = min((x + 1000) // 1000, X)
X -= t
x -= t * 1000
if x >= 0:
heappush(A, -x)
if len(A) == 0:
print('Yes')
else:
print('No')
c-yan