結果

問題 No.1015 おつりは要らないです
ユーザー lloyzlloyz
提出日時 2022-06-30 21:55:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 477 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 725 ms
コンパイル使用メモリ 87,056 KB
実行使用メモリ 92,076 KB
最終ジャッジ日時 2023-08-16 09:43:51
合計ジャッジ時間 16,634 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,140 KB
testcase_01 AC 75 ms
71,108 KB
testcase_02 AC 74 ms
71,260 KB
testcase_03 AC 72 ms
71,300 KB
testcase_04 AC 73 ms
71,400 KB
testcase_05 AC 75 ms
71,256 KB
testcase_06 AC 73 ms
71,260 KB
testcase_07 AC 73 ms
71,128 KB
testcase_08 AC 74 ms
71,344 KB
testcase_09 AC 72 ms
71,236 KB
testcase_10 AC 430 ms
91,764 KB
testcase_11 AC 451 ms
91,740 KB
testcase_12 AC 444 ms
91,620 KB
testcase_13 AC 426 ms
91,716 KB
testcase_14 AC 462 ms
91,932 KB
testcase_15 AC 463 ms
91,664 KB
testcase_16 AC 453 ms
91,828 KB
testcase_17 AC 471 ms
91,824 KB
testcase_18 AC 447 ms
91,736 KB
testcase_19 AC 439 ms
91,976 KB
testcase_20 AC 477 ms
91,552 KB
testcase_21 AC 436 ms
91,516 KB
testcase_22 AC 440 ms
91,180 KB
testcase_23 AC 422 ms
91,308 KB
testcase_24 AC 443 ms
91,420 KB
testcase_25 AC 447 ms
91,440 KB
testcase_26 AC 447 ms
91,508 KB
testcase_27 AC 460 ms
91,664 KB
testcase_28 AC 425 ms
91,324 KB
testcase_29 AC 472 ms
91,348 KB
testcase_30 AC 73 ms
71,452 KB
testcase_31 AC 324 ms
89,396 KB
testcase_32 AC 335 ms
89,576 KB
testcase_33 AC 362 ms
92,076 KB
testcase_34 AC 74 ms
71,384 KB
testcase_35 AC 75 ms
71,276 KB
testcase_36 AC 76 ms
70,972 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappop, heappush

n, x, y, z = map(int, input().split())
A = list(map(int, input().split()))
for i in range(n):
    A[i] += 1
    A[i] *= -1

heapify(A)
Y = [10000, 5000, 1000]
C = [z, y, x]
for i in range(3):
    yen = Y[i]
    cnt = C[i]
    for j in range(n):
        a = -heappop(A)
        use = min(a // yen, cnt)
        cnt -= use
        heappush(A, -a + use * yen)
    for j in range(n):
        a = -heappop(A)
        if cnt > 0:
            cnt -= 1
            a = 0
        heappush(A, -a)
for i in range(n):
    if A[i] < 0:
        print("No")
        exit()
print("Yes")
0