結果

問題 No.1015 おつりは要らないです
ユーザー c-yanc-yan
提出日時 2020-04-05 03:55:49
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 546 bytes
コンパイル時間 92 ms
コンパイル使用メモリ 10,788 KB
実行使用メモリ 19,140 KB
最終ジャッジ日時 2023-09-16 06:26:48
合計ジャッジ時間 10,540 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,964 KB
testcase_01 AC 17 ms
8,028 KB
testcase_02 AC 17 ms
7,916 KB
testcase_03 AC 16 ms
7,964 KB
testcase_04 AC 17 ms
7,944 KB
testcase_05 AC 16 ms
7,992 KB
testcase_06 AC 16 ms
7,992 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 498 ms
18,592 KB
testcase_11 AC 513 ms
18,792 KB
testcase_12 AC 483 ms
18,236 KB
testcase_13 AC 487 ms
18,616 KB
testcase_14 AC 487 ms
19,140 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 322 ms
18,676 KB
testcase_21 AC 309 ms
18,632 KB
testcase_22 AC 319 ms
18,708 KB
testcase_23 AC 324 ms
18,072 KB
testcase_24 AC 331 ms
18,748 KB
testcase_25 AC 317 ms
18,612 KB
testcase_26 AC 313 ms
18,500 KB
testcase_27 AC 322 ms
18,600 KB
testcase_28 AC 311 ms
18,468 KB
testcase_29 AC 321 ms
18,792 KB
testcase_30 AC 17 ms
7,928 KB
testcase_31 AC 92 ms
10,084 KB
testcase_32 AC 92 ms
10,040 KB
testcase_33 AC 79 ms
19,012 KB
testcase_34 AC 17 ms
8,088 KB
testcase_35 AC 17 ms
7,960 KB
testcase_36 AC 16 ms
8,092 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush

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

amounts = [Z, Y, X]
bills = [10000, 5000, 1000]

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

for i in range(3):
    a = amounts[i]
    b = bills[i]

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

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