結果

問題 No.1015 おつりは要らないです
ユーザー c-yan
提出日時 2020-04-03 21:39:06
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 773 bytes
コンパイル時間 326 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,724 KB
最終ジャッジ日時 2024-07-03 01:48:29
合計ジャッジ時間 7,171 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X, Y, Z = map(int, input().split())
A = list(map(int, input().split()))

A.sort(reverse=True)
for a in A:
    a += 1
    if a >= 10000:
        t = a // 10000
        t = min(t, Z)
        Z -= t
        a -= t * 10000
    if a >= 5000:
        t = a // 5000
        t = min(t, Y)
        Y -= t
        a -= t * 5000
    if X != 0:
        t = (a + 999) // 1000
        t = min(t, X)
        X -= t
        a -= t * 1000
    if a <= 0:
        continue
    if Y != 0:
        t = (a + 4999) // 5000
        t = min(t, Y)
        Y -= t
        a -= t * 5000
    if a <= 0:
        continue
    if X != 0:
        t = (a + 9999) // 10000
        t = min(t, Z)
        Z -= t
        a -= t * 10000
    if a <= 0:
        continue
    print('No')
    exit()

print('Yes')
0