結果

問題 No.1015 おつりは要らないです
ユーザー yosakayosaka
提出日時 2020-04-03 23:24:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 290 ms / 2,000 ms
コード長 635 bytes
コンパイル時間 169 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 96,896 KB
最終ジャッジ日時 2024-04-29 01:19:55
合計ジャッジ時間 8,196 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
52,480 KB
testcase_01 AC 47 ms
52,608 KB
testcase_02 AC 44 ms
52,352 KB
testcase_03 AC 44 ms
52,096 KB
testcase_04 AC 43 ms
52,480 KB
testcase_05 AC 43 ms
52,480 KB
testcase_06 AC 43 ms
52,480 KB
testcase_07 AC 43 ms
52,608 KB
testcase_08 AC 44 ms
52,224 KB
testcase_09 AC 45 ms
52,608 KB
testcase_10 AC 290 ms
90,368 KB
testcase_11 AC 290 ms
90,880 KB
testcase_12 AC 280 ms
90,240 KB
testcase_13 AC 289 ms
90,624 KB
testcase_14 AC 289 ms
90,368 KB
testcase_15 AC 286 ms
90,240 KB
testcase_16 AC 285 ms
90,752 KB
testcase_17 AC 287 ms
90,496 KB
testcase_18 AC 286 ms
90,368 KB
testcase_19 AC 290 ms
90,752 KB
testcase_20 AC 289 ms
90,368 KB
testcase_21 AC 280 ms
90,240 KB
testcase_22 AC 282 ms
89,984 KB
testcase_23 AC 278 ms
89,984 KB
testcase_24 AC 284 ms
90,240 KB
testcase_25 AC 287 ms
90,112 KB
testcase_26 AC 282 ms
89,984 KB
testcase_27 AC 279 ms
90,112 KB
testcase_28 AC 276 ms
89,984 KB
testcase_29 AC 281 ms
90,112 KB
testcase_30 AC 43 ms
52,480 KB
testcase_31 AC 157 ms
95,360 KB
testcase_32 AC 157 ms
95,104 KB
testcase_33 AC 124 ms
96,896 KB
testcase_34 AC 44 ms
52,608 KB
testcase_35 AC 43 ms
52,608 KB
testcase_36 AC 43 ms
52,224 KB
権限があれば一括ダウンロードができます

ソースコード

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