結果

問題 No.1015 おつりは要らないです
コンテスト
ユーザー yuly3
提出日時 2020-04-30 19:21:30
言語 PyPy3
(8.0.1 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 71 ms / 2,000 ms
+ 550µs
コード長 899 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,426 ms
コンパイル使用メモリ 63,732 KB
実行使用メモリ 73,208 KB
最終ジャッジ日時 2026-10-29 12:13:06
合計ジャッジ時間 5,016 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 34
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N, X, Y, Z = map(int, rl().split())
    A = list(map(int, rl().split()))
    
    i = 0
    while 0 < Z and i < N:
        t = min(A[i] // 10000, Z)
        A[i] -= 10000 * t
        Z -= t
        i += 1
    A.sort(reverse=True)
    i = 0
    while 0 < Z and i < N:
        A[i] -= 10000
        Z -= 1
        i += 1
    
    i = 0
    while 0 < Y and i < N:
        if A[i] < 0:
            i += 1
            continue
        t = min(A[i] // 5000, Y)
        A[i] -= 5000 * t
        Y -= t
        i += 1
    A.sort(reverse=True)
    i = 0
    while 0 < Y and i < N:
        A[i] -= 5000
        Y -= 1
        i += 1
    
    cnt = 0
    for ai in A:
        if ai < 0:
            continue
        cnt += -(-(ai + 1) // 1000)
    print('Yes' if cnt <= X else 'No')


if __name__ == '__main__':
    solve()
0