結果

問題 No.1015 おつりは要らないです
ユーザー Lily0727K
提出日時 2020-04-04 13:09:26
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 535 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,832 KB
最終ジャッジ日時 2024-07-03 07:17:03
合計ジャッジ時間 10,600 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 2
other AC * 30 WA * 3
権限があれば一括ダウンロードができます

ソースコード

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):
        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