結果

問題 No.1015 おつりは要らないです
ユーザー None
提出日時 2021-05-01 07:53:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 492 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 81,920 KB
実行使用メモリ 88,576 KB
最終ジャッジ日時 2024-07-19 10:48:35
合計ジャッジ時間 3,938 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 18 WA * 15
権限があれば一括ダウンロードができます

ソースコード

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//5000,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