結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
komkompi
|
| 提出日時 | 2023-11-04 10:12:34 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 265 ms / 2,000 ms |
| コード長 | 612 bytes |
| コンパイル時間 | 174 ms |
| コンパイル使用メモリ | 82,432 KB |
| 実行使用メモリ | 90,880 KB |
| 最終ジャッジ日時 | 2024-09-25 21:54:34 |
| 合計ジャッジ時間 | 7,306 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 33 |
ソースコード
# coding: utf-8
# Your code here!
import heapq as hq
N,X,Y,Z=map(int,input().split())
A=list(map(lambda x:-int(x),input().split()))
hq.heapify(A)
for money,n in zip([10000,5000,1000],[Z,Y,X]):
while n>0 and A:
shop=hq.heappop(A)
use=min(-shop//money,n)
if use==0:
hq.heappush(A,shop)
break
else:
shop+=use*money
n-=use
hq.heappush(A,shop)
while A:
if n==0:
break
else:
garbage=hq.heappop(A)
n-=1
if A:
print("No")
else:
print("Yes")
komkompi