結果

問題 No.1015 おつりは要らないです
ユーザー komkompi
提出日時 2023-11-04 10:10:35
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 606 bytes
コンパイル時間 308 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 91,264 KB
最終ジャッジ日時 2024-09-25 21:54:27
合計ジャッジ時間 7,627 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 32 RE * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

# 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:
        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")
    

0