結果

問題 No.1015 おつりは要らないです
ユーザー hedwig100hedwig100
提出日時 2020-04-03 21:45:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 131 ms / 2,000 ms
コード長 1,346 bytes
コンパイル時間 359 ms
コンパイル使用メモリ 87,120 KB
実行使用メモリ 87,736 KB
最終ジャッジ日時 2023-08-11 08:39:00
合計ジャッジ時間 6,091 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,172 KB
testcase_01 AC 74 ms
71,176 KB
testcase_02 AC 73 ms
71,336 KB
testcase_03 AC 75 ms
71,276 KB
testcase_04 AC 76 ms
71,456 KB
testcase_05 AC 76 ms
71,332 KB
testcase_06 AC 75 ms
71,180 KB
testcase_07 AC 75 ms
70,968 KB
testcase_08 AC 77 ms
71,200 KB
testcase_09 AC 77 ms
71,320 KB
testcase_10 AC 124 ms
86,372 KB
testcase_11 AC 125 ms
86,696 KB
testcase_12 AC 121 ms
86,360 KB
testcase_13 AC 124 ms
86,084 KB
testcase_14 AC 124 ms
87,160 KB
testcase_15 AC 121 ms
86,196 KB
testcase_16 AC 125 ms
86,536 KB
testcase_17 AC 122 ms
86,992 KB
testcase_18 AC 123 ms
86,328 KB
testcase_19 AC 124 ms
86,516 KB
testcase_20 AC 128 ms
87,468 KB
testcase_21 AC 127 ms
87,528 KB
testcase_22 AC 126 ms
87,048 KB
testcase_23 AC 127 ms
87,032 KB
testcase_24 AC 127 ms
87,284 KB
testcase_25 AC 126 ms
87,452 KB
testcase_26 AC 126 ms
87,176 KB
testcase_27 AC 131 ms
87,224 KB
testcase_28 AC 128 ms
87,416 KB
testcase_29 AC 128 ms
87,736 KB
testcase_30 AC 74 ms
71,304 KB
testcase_31 AC 96 ms
83,804 KB
testcase_32 AC 97 ms
83,624 KB
testcase_33 AC 100 ms
85,188 KB
testcase_34 AC 76 ms
70,964 KB
testcase_35 AC 76 ms
71,212 KB
testcase_36 AC 74 ms
71,124 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