結果

問題 No.1015 おつりは要らないです
ユーザー w0mbatw0mbat
提出日時 2020-11-03 22:00:32
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 86,932 KB
実行使用メモリ 92,852 KB
最終ジャッジ日時 2023-09-29 15:01:59
合計ジャッジ時間 9,671 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,272 KB
testcase_01 AC 76 ms
71,148 KB
testcase_02 AC 74 ms
71,476 KB
testcase_03 AC 72 ms
71,280 KB
testcase_04 AC 73 ms
71,456 KB
testcase_05 AC 73 ms
71,432 KB
testcase_06 AC 72 ms
71,184 KB
testcase_07 AC 73 ms
71,284 KB
testcase_08 AC 74 ms
71,148 KB
testcase_09 AC 73 ms
71,152 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 257 ms
92,852 KB
testcase_16 AC 272 ms
92,528 KB
testcase_17 AC 268 ms
92,392 KB
testcase_18 AC 265 ms
92,484 KB
testcase_19 AC 265 ms
92,296 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 72 ms
70,940 KB
testcase_31 AC 131 ms
91,592 KB
testcase_32 AC 132 ms
91,484 KB
testcase_33 AC 135 ms
92,748 KB
testcase_34 AC 75 ms
71,236 KB
testcase_35 WA -
testcase_36 AC 74 ms
71,400 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heapify, heappush, heappop
import sys
def main():
    input = sys.stdin.readline
    N, X, Y, Z = map(int, input().split())
    *A, = map(lambda x: -int(x), input().split())
    heapify(A)
    cnt = [Z, Y, X]
    for c, n in enumerate([10000, 5000, 1000]):
        while A and cnt[c] > 0:
            p = -heappop(A)
            d = (p + 1) // n
            if d == 0:
                cnt[c] -= 1
                continue
            d = min(d, cnt[c])
            heappush(A, n * d - p)
            cnt[c] -= d
    print('No' if A else 'Yes')

if __name__ == '__main__':
    main()
0