結果

問題 No.1015 おつりは要らないです
ユーザー c-yanc-yan
提出日時 2020-04-03 23:07:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 752 bytes
コンパイル時間 118 ms
コンパイル使用メモリ 10,900 KB
実行使用メモリ 19,264 KB
最終ジャッジ日時 2023-09-16 04:22:18
合計ジャッジ時間 8,577 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,016 KB
testcase_01 AC 18 ms
8,128 KB
testcase_02 AC 16 ms
8,036 KB
testcase_03 AC 16 ms
8,136 KB
testcase_04 AC 17 ms
8,036 KB
testcase_05 AC 17 ms
8,140 KB
testcase_06 AC 17 ms
8,040 KB
testcase_07 AC 16 ms
8,036 KB
testcase_08 WA -
testcase_09 AC 17 ms
8,012 KB
testcase_10 AC 318 ms
18,688 KB
testcase_11 AC 322 ms
18,832 KB
testcase_12 AC 302 ms
18,316 KB
testcase_13 AC 305 ms
18,696 KB
testcase_14 AC 326 ms
19,264 KB
testcase_15 AC 301 ms
18,456 KB
testcase_16 AC 310 ms
18,736 KB
testcase_17 AC 325 ms
19,064 KB
testcase_18 AC 318 ms
18,696 KB
testcase_19 AC 316 ms
18,628 KB
testcase_20 AC 320 ms
18,768 KB
testcase_21 AC 322 ms
18,644 KB
testcase_22 AC 324 ms
18,768 KB
testcase_23 AC 310 ms
18,192 KB
testcase_24 AC 338 ms
18,812 KB
testcase_25 AC 326 ms
18,740 KB
testcase_26 AC 323 ms
18,572 KB
testcase_27 AC 321 ms
18,572 KB
testcase_28 AC 310 ms
18,672 KB
testcase_29 AC 325 ms
18,848 KB
testcase_30 AC 16 ms
7,968 KB
testcase_31 AC 102 ms
10,156 KB
testcase_32 AC 103 ms
10,152 KB
testcase_33 AC 79 ms
19,000 KB
testcase_34 AC 16 ms
8,072 KB
testcase_35 AC 17 ms
8,020 KB
testcase_36 AC 16 ms
8,040 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush

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

A = [-a - 1 for a in A]
heapify(A)

while A:
    if Z == 0:
        break
    x = -heappop(A)
    if x >= 10000:
        t = min(x // 10000, Z)
        Z -= t
        x -= 10000 * t
        if x != 0:
            heappush(A, -x)
    else:
        Z -= 1

while A:
    if Y == 0:
        break
    x = -heappop(A)
    if x >= 5000:
        t = min(x // 5000, Y)
        Y -= t
        x -= 5000 * t
        if x != 0:
            heappush(A, -x)
    else:
        Y -= 1

while A:
    if X == 0:
        break
    x = -heappop(A)
    t = min((x + 999) // 1000, X)
    X -= t

if len(A) == 0:
    print('Yes')
else:
    print('No')
0