結果

問題 No.1015 おつりは要らないです
ユーザー Lily0727K
提出日時 2020-04-04 13:12:02
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 487 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 129 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 21,668 KB
最終ジャッジ日時 2024-11-18 05:45:32
合計ジャッジ時間 11,073 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

n, *bill_cnt = map(int, input().split())
bill_money = [1000, 5000, 10000]

arr = [a + 1 for a in map(int, input().split())]
arr.sort(reverse=True)

for i in reversed(range(3)):
    cnt = bill_cnt[i]
    money = bill_money[i]

    for j in range(n):
        if arr[j] > 0:
            use_cnt = min(arr[j] // money, cnt)
            cnt -= use_cnt
            arr[j] -= use_cnt * money
    arr.sort(reverse=True)
    for j in range(n):
        if cnt > 0:
            cnt -= 1
            arr[j] -= money
    arr.sort(reverse=True)

print("Yes" if arr[0] <= 0 else "No")
0