結果

問題 No.1015 おつりは要らないです
ユーザー hedwig100hedwig100
提出日時 2020-04-03 21:45:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 1,346 bytes
コンパイル時間 153 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 82,304 KB
最終ジャッジ日時 2024-04-29 01:11:26
合計ジャッジ時間 4,395 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
52,608 KB
testcase_01 AC 46 ms
52,736 KB
testcase_02 AC 44 ms
52,608 KB
testcase_03 AC 44 ms
52,864 KB
testcase_04 AC 44 ms
52,608 KB
testcase_05 AC 44 ms
52,736 KB
testcase_06 AC 45 ms
52,608 KB
testcase_07 AC 44 ms
52,736 KB
testcase_08 AC 44 ms
52,352 KB
testcase_09 AC 46 ms
52,736 KB
testcase_10 AC 103 ms
80,128 KB
testcase_11 AC 106 ms
80,128 KB
testcase_12 AC 103 ms
79,232 KB
testcase_13 AC 101 ms
79,360 KB
testcase_14 AC 104 ms
80,384 KB
testcase_15 AC 100 ms
79,872 KB
testcase_16 AC 101 ms
79,616 KB
testcase_17 AC 104 ms
79,872 KB
testcase_18 AC 101 ms
79,744 KB
testcase_19 AC 102 ms
79,872 KB
testcase_20 AC 110 ms
82,304 KB
testcase_21 AC 107 ms
81,536 KB
testcase_22 AC 108 ms
81,536 KB
testcase_23 AC 104 ms
81,280 KB
testcase_24 AC 108 ms
81,664 KB
testcase_25 AC 106 ms
81,792 KB
testcase_26 AC 107 ms
81,280 KB
testcase_27 AC 105 ms
81,280 KB
testcase_28 AC 106 ms
81,536 KB
testcase_29 AC 107 ms
82,176 KB
testcase_30 AC 44 ms
52,736 KB
testcase_31 AC 72 ms
74,240 KB
testcase_32 AC 72 ms
74,368 KB
testcase_33 AC 77 ms
78,848 KB
testcase_34 AC 45 ms
52,736 KB
testcase_35 AC 45 ms
52,608 KB
testcase_36 AC 44 ms
52,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
INF = 10 ** 10
MOD = 10 ** 9 + 7
from heapq import heapify,heappop,heappush
input = sys.stdin.readline
from bisect import bisect_left

def to(n):
    return (n//1000 + 1) * 1000

def main():
    n,x,y,z = map(int,input().split())
    a = [to(int(i)) for i in input().split()]
    a.sort(reverse = True)
    for i in range(n):
        if z == 0:
            break
        if a[i] > 10000:
            if a[i]//10000 <= z:
                z -= a[i]//10000
                a[i] %= 10000
            else:
                a[i] -= z * 10000
                z = 0

    if z > 0:
        a.sort(reverse = True)
        for i in range(min(z,n)):
            a[i] = 0
    
    a.sort(reverse = True)
    for i in range(n):
        if y == 0:
            break
        if a[i] > 5000:
            if a[i]//5000 <= y:
                y -= a[i]//5000
                a[i] %= 5000
            else:
                a[i] -= y * 5000
                y = 0
    
    if y > 0:
        a.sort(reverse = True)
        for i in range(min(y,n)):
            a[i] = 0
    
    for i in range(n):
        if a[i] > 0:
            x -= (a[i] + 999)//1000

    if x < 0:
        print('No')
    else:
        print('Yes')                

if __name__ == '__main__':
    main()
        





    
    
0