結果

問題 No.1015 おつりは要らないです
ユーザー AlphaGiraffeAlphaGiraffe
提出日時 2020-04-03 21:56:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 541 ms / 2,000 ms
コード長 635 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,920 KB
最終ジャッジ日時 2024-11-17 23:09:58
合計ジャッジ時間 11,971 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
from heapq import heappop, heappush,heapify

N,X,Y,Z=map(int,input().split())
A=list(map(int,input().split()))

H=[]

for i in range(N):
    heappush(H,-A[i])

flg=True

while H[0]<=0:
    M=heappop(H)
    if Z>0:
        num=max(1,min(Z,(-M)//10000))
        M+=10000*num
        Z-=num
        heappush(H,M)
    elif Y>0:
        num=max(1,min(Y,(-M)//5000))
        M+=5000*num
        Y-=num
        heappush(H,M)
    elif X>0:
        num=max(1,min(X,(-M)//1000))
        M+=1000*num
        X-=num
        heappush(H,M)
    elif M<=0:
        flg=False
        break
if flg:
    print("Yes")
else:
    print("No")
0