結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,072 KB
testcase_01 AC 17 ms
7,832 KB
testcase_02 AC 17 ms
8,012 KB
testcase_03 AC 17 ms
8,008 KB
testcase_04 AC 16 ms
8,116 KB
testcase_05 AC 16 ms
8,048 KB
testcase_06 AC 17 ms
8,008 KB
testcase_07 AC 18 ms
8,004 KB
testcase_08 WA -
testcase_09 AC 17 ms
8,000 KB
testcase_10 AC 308 ms
18,584 KB
testcase_11 AC 319 ms
18,868 KB
testcase_12 AC 295 ms
18,100 KB
testcase_13 AC 304 ms
18,708 KB
testcase_14 AC 320 ms
18,924 KB
testcase_15 AC 304 ms
18,172 KB
testcase_16 AC 310 ms
18,640 KB
testcase_17 AC 316 ms
18,824 KB
testcase_18 AC 307 ms
18,700 KB
testcase_19 AC 304 ms
18,504 KB
testcase_20 AC 317 ms
18,772 KB
testcase_21 AC 316 ms
18,644 KB
testcase_22 AC 318 ms
18,624 KB
testcase_23 AC 302 ms
18,160 KB
testcase_24 AC 325 ms
18,828 KB
testcase_25 AC 316 ms
18,584 KB
testcase_26 AC 316 ms
18,740 KB
testcase_27 AC 311 ms
18,608 KB
testcase_28 AC 308 ms
18,532 KB
testcase_29 AC 324 ms
18,656 KB
testcase_30 AC 16 ms
8,052 KB
testcase_31 AC 102 ms
10,032 KB
testcase_32 AC 102 ms
9,960 KB
testcase_33 AC 76 ms
19,064 KB
testcase_34 AC 16 ms
8,052 KB
testcase_35 AC 16 ms
8,076 KB
testcase_36 AC 15 ms
8,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush

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

A = [-a 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
        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
        heappush(A, -x)
    else:
        Y -= 1

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

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