結果

問題 No.1015 おつりは要らないです
ユーザー とらすたとらすた
提出日時 2020-04-03 23:07:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 856 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 89,728 KB
最終ジャッジ日時 2024-04-29 01:18:32
合計ジャッジ時間 4,382 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,968 KB
testcase_01 AC 42 ms
52,096 KB
testcase_02 AC 42 ms
52,608 KB
testcase_03 AC 42 ms
52,096 KB
testcase_04 AC 42 ms
51,968 KB
testcase_05 AC 40 ms
52,096 KB
testcase_06 AC 44 ms
51,840 KB
testcase_07 AC 42 ms
51,840 KB
testcase_08 AC 41 ms
52,096 KB
testcase_09 AC 41 ms
51,840 KB
testcase_10 AC 105 ms
88,832 KB
testcase_11 AC 107 ms
89,216 KB
testcase_12 AC 105 ms
88,448 KB
testcase_13 AC 107 ms
89,088 KB
testcase_14 AC 108 ms
89,728 KB
testcase_15 AC 104 ms
88,576 KB
testcase_16 AC 106 ms
89,088 KB
testcase_17 AC 109 ms
89,728 KB
testcase_18 AC 106 ms
88,704 KB
testcase_19 AC 106 ms
88,960 KB
testcase_20 AC 102 ms
87,552 KB
testcase_21 AC 101 ms
87,552 KB
testcase_22 AC 100 ms
87,552 KB
testcase_23 AC 99 ms
87,040 KB
testcase_24 AC 102 ms
88,064 KB
testcase_25 AC 101 ms
87,680 KB
testcase_26 AC 101 ms
87,296 KB
testcase_27 AC 99 ms
87,424 KB
testcase_28 AC 100 ms
87,296 KB
testcase_29 AC 99 ms
87,552 KB
testcase_30 AC 41 ms
52,224 KB
testcase_31 AC 73 ms
81,664 KB
testcase_32 AC 75 ms
81,920 KB
testcase_33 AC 81 ms
88,064 KB
testcase_34 AC 42 ms
52,096 KB
testcase_35 AC 42 ms
52,096 KB
testcase_36 AC 42 ms
52,352 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