結果

問題 No.1015 おつりは要らないです
ユーザー None
提出日時 2021-05-01 07:42:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 87,424 KB
最終ジャッジ日時 2024-07-19 10:37:24
合計ジャッジ時間 4,758 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 14 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

N,X,Y,Z=map(int, input().split())
A=list(map(int, input().split()))
A.sort(reverse=True)
for a in A:
    if X<0 or Y<0 or Z<0:
        print("No")
        exit()
    z=min(a//10000,Z)
    a-=z*10000
    Z-=z
    if a<0:
        continue
    if Y==X==0:
        Z-=1
        continue
    y=min(a//10000,Y)
    a-=y*5000
    Y-=y
    if a<0:
        continue
    if X==0:
        Y-=1
        continue
    x=(a-1)//1000 + 1
    X-=x

if X<0 or Y<0 or Z<0:
    print("No")
    exit()
print("Yes")
0