結果

問題 No.1015 おつりは要らないです
ユーザー Ryushi-techRyushi-tech
提出日時 2020-06-27 15:10:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 768 bytes
コンパイル時間 779 ms
コンパイル使用メモリ 10,844 KB
実行使用メモリ 19,004 KB
最終ジャッジ日時 2023-09-18 19:30:19
合計ジャッジ時間 10,254 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
7,952 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 17 ms
7,936 KB
testcase_04 AC 17 ms
8,080 KB
testcase_05 AC 17 ms
7,884 KB
testcase_06 AC 17 ms
7,892 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 451 ms
18,532 KB
testcase_11 AC 455 ms
18,744 KB
testcase_12 AC 426 ms
18,204 KB
testcase_13 AC 444 ms
18,648 KB
testcase_14 AC 470 ms
18,940 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 319 ms
18,732 KB
testcase_21 AC 320 ms
18,640 KB
testcase_22 AC 317 ms
18,556 KB
testcase_23 AC 306 ms
18,192 KB
testcase_24 AC 325 ms
18,808 KB
testcase_25 AC 319 ms
18,696 KB
testcase_26 AC 320 ms
18,516 KB
testcase_27 AC 309 ms
18,560 KB
testcase_28 AC 316 ms
18,592 KB
testcase_29 AC 320 ms
18,728 KB
testcase_30 AC 17 ms
7,900 KB
testcase_31 AC 96 ms
10,040 KB
testcase_32 WA -
testcase_33 AC 87 ms
19,004 KB
testcase_34 AC 17 ms
7,964 KB
testcase_35 AC 17 ms
8,056 KB
testcase_36 AC 17 ms
8,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heapify, heappush
n, x, y, z = map(int, input().split())
A = list(int(-a) for a in map(int, input().split()))
heapify(A)

while A:
    if not z:
        break
    a = -heappop(A)
    if a >= 10000:
        use = min(a//10000, z)
        z -= use
        a -= use * 10000
        heappush(A, -a)
    else:
        z = -1

while A:
    if not y:
        break
    a = -heappop(A)
    if a >= 5000:
        use = min(a//5000, y)
        y -= use
        a -= use * 5000
        heappush(A, -a)
    else:
        y = -1

while A:
    if not x:
        break
    a = -heappop(A)
    if a >= 1000:
        use = min(a//1000, x)
        x -= use
        a -= use * 1000
        heappush(A, -a)
    else:
        x = -1

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