結果

問題 No.1015 おつりは要らないです
ユーザー lloyzlloyz
提出日時 2022-06-30 21:55:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 427 ms / 2,000 ms
コード長 617 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 90,764 KB
最終ジャッジ日時 2024-05-03 18:26:19
合計ジャッジ時間 11,723 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,480 KB
testcase_01 AC 41 ms
52,608 KB
testcase_02 AC 39 ms
52,352 KB
testcase_03 AC 39 ms
52,608 KB
testcase_04 AC 39 ms
52,992 KB
testcase_05 AC 40 ms
52,608 KB
testcase_06 AC 39 ms
52,480 KB
testcase_07 AC 40 ms
52,608 KB
testcase_08 AC 40 ms
52,096 KB
testcase_09 AC 41 ms
52,864 KB
testcase_10 AC 390 ms
90,328 KB
testcase_11 AC 408 ms
90,764 KB
testcase_12 AC 409 ms
90,300 KB
testcase_13 AC 377 ms
90,240 KB
testcase_14 AC 414 ms
90,492 KB
testcase_15 AC 402 ms
90,752 KB
testcase_16 AC 407 ms
90,368 KB
testcase_17 AC 427 ms
90,620 KB
testcase_18 AC 401 ms
90,240 KB
testcase_19 AC 403 ms
90,752 KB
testcase_20 AC 423 ms
90,112 KB
testcase_21 AC 397 ms
89,984 KB
testcase_22 AC 377 ms
89,984 KB
testcase_23 AC 369 ms
90,368 KB
testcase_24 AC 401 ms
90,340 KB
testcase_25 AC 400 ms
90,368 KB
testcase_26 AC 411 ms
90,112 KB
testcase_27 AC 414 ms
90,132 KB
testcase_28 AC 380 ms
90,140 KB
testcase_29 AC 418 ms
89,984 KB
testcase_30 AC 44 ms
52,480 KB
testcase_31 AC 289 ms
88,448 KB
testcase_32 AC 277 ms
88,064 KB
testcase_33 AC 309 ms
90,624 KB
testcase_34 AC 40 ms
52,864 KB
testcase_35 AC 40 ms
52,480 KB
testcase_36 AC 40 ms
52,352 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