結果

問題 No.1015 おつりは要らないです
コンテスト
ユーザー flippergo
提出日時 2026-11-19 18:23:49
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 84 ms / 2,000 ms
+ 165µs
コード長 871 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 86 ms
コンパイル使用メモリ 64,544 KB
実行使用メモリ 76,556 KB
最終ジャッジ日時 2026-11-19 18:23:55
合計ジャッジ時間 5,437 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,X,Y,Z = map(int,input().split())
A = list(map(int,input().split()))
B = [A[i]//1000+1 for i in range(N)]
B = sorted(B,reverse=True)
for i in range(N):
    b = B[i]
    n = b//10
    if Z>=n:
        Z -= n
        B[i] = b-10*n
    else:
        B[i] = b-10*Z
        Z = 0
if Z>0:
    B = sorted(B,reverse=True)
    for i in range(N):
        B[i] = 0
        Z -= 1
        if Z==0:break
B = sorted(B,reverse=True)
for i in range(N):
    b = B[i]
    n = b//5
    if Y>=n:
        Y -= n
        B[i] = b-5*n
    else:
        B[i] = b-5*Y
        Y = 0
if Y>0:
    B = sorted(B,reverse=True)
    for i in range(N):
        B[i] = 0
        Y -= 1
        if Y==0:break
B = sorted(B,reverse=True)
for i in range(N):
    b = B[i]
    if X>=b:
        X -= b
        B[i] = 0
    else:
        B[i] -= X
        X = 0
if sum(B)>0:
    print("No")
else:
    print("Yes")
0