結果

問題 No.1015 おつりは要らないです
ユーザー c-yanc-yan
提出日時 2020-04-05 03:56:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 504 ms / 2,000 ms
コード長 542 bytes
コンパイル時間 83 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,572 KB
最終ジャッジ日時 2024-04-29 05:07:07
合計ジャッジ時間 10,961 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,624 KB
testcase_01 AC 31 ms
10,624 KB
testcase_02 AC 31 ms
10,624 KB
testcase_03 AC 33 ms
10,752 KB
testcase_04 AC 31 ms
10,752 KB
testcase_05 AC 30 ms
10,624 KB
testcase_06 AC 31 ms
10,624 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 31 ms
10,624 KB
testcase_09 AC 31 ms
10,624 KB
testcase_10 AC 493 ms
21,136 KB
testcase_11 AC 498 ms
21,420 KB
testcase_12 AC 456 ms
20,924 KB
testcase_13 AC 490 ms
21,256 KB
testcase_14 AC 503 ms
21,568 KB
testcase_15 AC 475 ms
20,936 KB
testcase_16 AC 483 ms
21,124 KB
testcase_17 AC 504 ms
21,436 KB
testcase_18 AC 472 ms
21,208 KB
testcase_19 AC 475 ms
20,992 KB
testcase_20 AC 394 ms
21,084 KB
testcase_21 AC 395 ms
21,112 KB
testcase_22 AC 404 ms
20,988 KB
testcase_23 AC 379 ms
20,652 KB
testcase_24 AC 401 ms
21,256 KB
testcase_25 AC 397 ms
20,992 KB
testcase_26 AC 389 ms
20,968 KB
testcase_27 AC 381 ms
20,904 KB
testcase_28 AC 380 ms
20,760 KB
testcase_29 AC 390 ms
21,028 KB
testcase_30 AC 31 ms
10,624 KB
testcase_31 AC 114 ms
12,672 KB
testcase_32 AC 116 ms
12,544 KB
testcase_33 AC 101 ms
21,572 KB
testcase_34 AC 31 ms
10,624 KB
testcase_35 AC 31 ms
10,624 KB
testcase_36 AC 30 ms
10,752 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, a)
            a -= t
            x -= b * t
            heappush(A, -x)
        else:
            a -= 1

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