結果

問題 No.1015 おつりは要らないです
ユーザー OKCH3COOHOKCH3COOH
提出日時 2020-04-11 08:23:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 401 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 546 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 18,920 KB
最終ジャッジ日時 2023-08-11 13:50:19
合計ジャッジ時間 9,861 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,992 KB
testcase_01 AC 17 ms
8,036 KB
testcase_02 AC 17 ms
8,048 KB
testcase_03 AC 17 ms
7,928 KB
testcase_04 AC 17 ms
7,948 KB
testcase_05 AC 16 ms
8,052 KB
testcase_06 AC 17 ms
7,948 KB
testcase_07 AC 16 ms
8,000 KB
testcase_08 AC 17 ms
8,044 KB
testcase_09 AC 17 ms
8,004 KB
testcase_10 AC 262 ms
18,724 KB
testcase_11 AC 276 ms
18,908 KB
testcase_12 AC 255 ms
18,156 KB
testcase_13 AC 268 ms
18,692 KB
testcase_14 AC 284 ms
18,920 KB
testcase_15 AC 263 ms
18,184 KB
testcase_16 AC 267 ms
18,676 KB
testcase_17 AC 274 ms
18,816 KB
testcase_18 AC 265 ms
18,584 KB
testcase_19 AC 260 ms
18,540 KB
testcase_20 AC 401 ms
18,728 KB
testcase_21 AC 393 ms
18,680 KB
testcase_22 AC 389 ms
18,688 KB
testcase_23 AC 379 ms
18,200 KB
testcase_24 AC 398 ms
18,828 KB
testcase_25 AC 387 ms
18,580 KB
testcase_26 AC 389 ms
18,712 KB
testcase_27 AC 391 ms
18,684 KB
testcase_28 AC 379 ms
18,372 KB
testcase_29 AC 396 ms
18,612 KB
testcase_30 AC 18 ms
7,984 KB
testcase_31 AC 141 ms
10,032 KB
testcase_32 AC 141 ms
10,040 KB
testcase_33 AC 128 ms
18,900 KB
testcase_34 AC 17 ms
8,048 KB
testcase_35 AC 17 ms
8,052 KB
testcase_36 AC 17 ms
8,028 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop, heapify

N, sen, gosen, man = map(int, input().split())
A = list(map(lambda a: -int(a), input().split()))

heapify(A)
while A and man > 0:
    a = -heappop(A)
    c = max(1, min(man, a // 10000))
    a -= c * 10000
    man -= c
    if a >= 0:
        heappush(A, -a)

while A and gosen > 0:
    a = -heappop(A)
    c = max(1, min(gosen, a // 5000))
    a -= c * 5000
    gosen -= c
    if a >= 0:
        heappush(A, -a)

A = [-a for a in A]

cnt = 0
for a in A:
    c = -(-a // 1000)
    if c * 1000 == a:
        c += 1
    cnt += c

print('Yes' if cnt <= sen else 'No')
0