結果

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

ソースコード

diff #

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

A.sort(reverse=True)
for a in A:
    print(a)
    if a >= 10000:
        t = a // 10000
        t = min(t, Z)
        if t != 0:
            print(10000, t)
        Z -= t
        a -= t * 10000
    if a >= 5000:
        t = a // 5000
        t = min(t, Y)
        if t != 0:
            print(5000, t)
        Y -= t
        a -= t * 5000
    if a >= 1000:
        t = (a + 999) // 1000
        t = min(t, X)
        if t != 0:
            print(1000, t)
        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