結果

問題 No.1015 おつりは要らないです
ユーザー OKCH3COOHOKCH3COOH
提出日時 2020-04-11 08:23:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 368 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,880 KB
最終ジャッジ日時 2024-04-29 06:12:03
合計ジャッジ時間 8,659 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,752 KB
testcase_01 AC 25 ms
10,624 KB
testcase_02 AC 26 ms
10,752 KB
testcase_03 AC 25 ms
10,752 KB
testcase_04 AC 24 ms
10,752 KB
testcase_05 AC 25 ms
10,752 KB
testcase_06 AC 24 ms
10,752 KB
testcase_07 AC 27 ms
10,752 KB
testcase_08 AC 28 ms
10,752 KB
testcase_09 AC 27 ms
10,752 KB
testcase_10 AC 249 ms
21,440 KB
testcase_11 AC 252 ms
21,564 KB
testcase_12 AC 243 ms
21,052 KB
testcase_13 AC 250 ms
21,288 KB
testcase_14 AC 287 ms
21,880 KB
testcase_15 AC 241 ms
21,120 KB
testcase_16 AC 254 ms
21,424 KB
testcase_17 AC 251 ms
21,752 KB
testcase_18 AC 253 ms
21,224 KB
testcase_19 AC 261 ms
21,312 KB
testcase_20 AC 352 ms
21,220 KB
testcase_21 AC 361 ms
21,140 KB
testcase_22 AC 356 ms
21,144 KB
testcase_23 AC 326 ms
20,796 KB
testcase_24 AC 357 ms
21,284 KB
testcase_25 AC 347 ms
21,084 KB
testcase_26 AC 353 ms
21,248 KB
testcase_27 AC 343 ms
20,916 KB
testcase_28 AC 348 ms
20,996 KB
testcase_29 AC 368 ms
21,132 KB
testcase_30 AC 25 ms
10,752 KB
testcase_31 AC 146 ms
12,672 KB
testcase_32 AC 151 ms
12,860 KB
testcase_33 AC 148 ms
21,716 KB
testcase_34 AC 27 ms
10,752 KB
testcase_35 AC 26 ms
10,752 KB
testcase_36 AC 25 ms
10,752 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