結果

問題 No.1015 おつりは要らないです
ユーザー rlangevinrlangevin
提出日時 2023-05-09 12:27:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 312 ms / 2,000 ms
コード長 686 bytes
コンパイル時間 697 ms
コンパイル使用メモリ 86,608 KB
実行使用メモリ 97,860 KB
最終ジャッジ日時 2023-08-17 05:46:12
合計ジャッジ時間 11,493 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
70,952 KB
testcase_01 AC 73 ms
71,160 KB
testcase_02 AC 73 ms
71,276 KB
testcase_03 AC 74 ms
71,080 KB
testcase_04 AC 78 ms
71,144 KB
testcase_05 AC 76 ms
71,084 KB
testcase_06 AC 74 ms
71,128 KB
testcase_07 AC 74 ms
71,360 KB
testcase_08 AC 73 ms
71,108 KB
testcase_09 AC 73 ms
71,164 KB
testcase_10 AC 306 ms
97,680 KB
testcase_11 AC 306 ms
97,564 KB
testcase_12 AC 298 ms
97,564 KB
testcase_13 AC 299 ms
97,436 KB
testcase_14 AC 312 ms
97,392 KB
testcase_15 AC 303 ms
97,256 KB
testcase_16 AC 300 ms
97,572 KB
testcase_17 AC 308 ms
97,384 KB
testcase_18 AC 303 ms
97,692 KB
testcase_19 AC 307 ms
97,596 KB
testcase_20 AC 282 ms
97,540 KB
testcase_21 AC 281 ms
97,500 KB
testcase_22 AC 282 ms
97,280 KB
testcase_23 AC 286 ms
97,352 KB
testcase_24 AC 295 ms
97,664 KB
testcase_25 AC 289 ms
97,384 KB
testcase_26 AC 289 ms
97,460 KB
testcase_27 AC 284 ms
97,552 KB
testcase_28 AC 281 ms
97,332 KB
testcase_29 AC 287 ms
97,444 KB
testcase_30 AC 76 ms
71,156 KB
testcase_31 AC 142 ms
95,480 KB
testcase_32 AC 143 ms
95,528 KB
testcase_33 AC 146 ms
97,860 KB
testcase_34 AC 75 ms
71,108 KB
testcase_35 AC 74 ms
71,504 KB
testcase_36 AC 74 ms
71,156 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import *

N, X, Y, Z = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x : -x, A))
heapify(A)
while Z and A:
    v = -heappop(A)
    if v >= 10000:
        n = min(Z, v // 10000)
        Z -= n
        v -= 10000 * n
        heappush(A, -v)
    else:
        Z -= 1

while Y and A:
    v = -heappop(A)
    if v >= 5000:
        n = min(Y, v // 5000)
        Y -= n
        v -= 5000 * n
        heappush(A, -v)
    else:
        Y -= 1

while X and A:
    v = -heappop(A)
    if v >= 1000:
        n = min(X, v // 1000)
        X -= n
        v -= 1000 * n
        heappush(A, -v)
    else:
        X -= 1

print("No") if A else print("Yes")
0