結果

問題 No.1015 おつりは要らないです
ユーザー とらすたとらすた
提出日時 2020-04-03 23:07:47
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 1,231 ms
コンパイル使用メモリ 86,640 KB
実行使用メモリ 94,928 KB
最終ジャッジ日時 2023-08-11 08:46:12
合計ジャッジ時間 6,355 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,180 KB
testcase_01 AC 70 ms
71,248 KB
testcase_02 AC 70 ms
71,180 KB
testcase_03 AC 72 ms
71,316 KB
testcase_04 AC 68 ms
71,312 KB
testcase_05 AC 70 ms
71,316 KB
testcase_06 AC 69 ms
71,088 KB
testcase_07 AC 71 ms
71,220 KB
testcase_08 AC 70 ms
71,320 KB
testcase_09 AC 70 ms
71,180 KB
testcase_10 AC 139 ms
94,540 KB
testcase_11 AC 122 ms
94,708 KB
testcase_12 AC 121 ms
94,356 KB
testcase_13 AC 125 ms
94,616 KB
testcase_14 AC 126 ms
94,832 KB
testcase_15 AC 121 ms
94,412 KB
testcase_16 AC 122 ms
94,388 KB
testcase_17 AC 125 ms
94,928 KB
testcase_18 AC 121 ms
94,428 KB
testcase_19 AC 121 ms
94,620 KB
testcase_20 AC 118 ms
93,752 KB
testcase_21 AC 117 ms
93,352 KB
testcase_22 AC 117 ms
93,700 KB
testcase_23 AC 115 ms
93,360 KB
testcase_24 AC 117 ms
93,576 KB
testcase_25 AC 120 ms
93,816 KB
testcase_26 AC 117 ms
93,632 KB
testcase_27 AC 118 ms
93,208 KB
testcase_28 AC 117 ms
93,268 KB
testcase_29 AC 117 ms
93,692 KB
testcase_30 AC 70 ms
70,972 KB
testcase_31 AC 96 ms
91,568 KB
testcase_32 AC 93 ms
91,484 KB
testcase_33 AC 100 ms
94,388 KB
testcase_34 AC 68 ms
71,120 KB
testcase_35 AC 70 ms
71,312 KB
testcase_36 AC 70 ms
71,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n,x,y,z = na()
a = na()
a.reverse()
b = [0]*n

#10000-
for i in range(n):
    k = a[i]//10000
    k = k if k < z else z
    a[i] -= 10000*k
    z -= k
    if z == 0:
        break

if len(a) <= z:
    print('Yes')
    exit()

a = sorted(a, reverse=True)[z:]

#5000-
for i in range(len(a)):
    k = a[i]//5000
    k = k if k < y else y
    a[i] -= 5000*k
    y -= k
    if y == 0:
        break

if len(a) <= y:
    print('Yes')
    exit()

a = sorted(a, reverse=True)[y:]

#1000-
for i in range(len(a)):
    k = a[i]//1000
    k = k if k < x else x
    a[i] -= 1000*k
    x -= k
    if x == 0:
        break

if len(a) <= x:
    print('Yes')
    exit()

print('No')
0