結果

問題 No.1015 おつりは要らないです
ユーザー ptotqptotq
提出日時 2020-04-03 22:02:31
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 292 ms / 2,000 ms
コード長 831 bytes
コンパイル時間 210 ms
コンパイル使用メモリ 11,064 KB
実行使用メモリ 19,124 KB
最終ジャッジ日時 2023-08-11 08:42:09
合計ジャッジ時間 7,402 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,856 KB
testcase_01 AC 17 ms
7,792 KB
testcase_02 AC 17 ms
7,864 KB
testcase_03 AC 16 ms
7,804 KB
testcase_04 AC 16 ms
7,768 KB
testcase_05 AC 16 ms
7,780 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,852 KB
testcase_08 AC 16 ms
7,768 KB
testcase_09 AC 16 ms
7,768 KB
testcase_10 AC 279 ms
18,864 KB
testcase_11 AC 281 ms
18,948 KB
testcase_12 AC 265 ms
18,404 KB
testcase_13 AC 278 ms
18,548 KB
testcase_14 AC 292 ms
19,124 KB
testcase_15 AC 273 ms
18,336 KB
testcase_16 AC 282 ms
18,788 KB
testcase_17 AC 283 ms
19,124 KB
testcase_18 AC 274 ms
18,512 KB
testcase_19 AC 277 ms
18,700 KB
testcase_20 AC 206 ms
18,688 KB
testcase_21 AC 206 ms
18,536 KB
testcase_22 AC 208 ms
18,596 KB
testcase_23 AC 195 ms
18,312 KB
testcase_24 AC 209 ms
18,940 KB
testcase_25 AC 208 ms
18,624 KB
testcase_26 AC 199 ms
18,600 KB
testcase_27 AC 201 ms
18,440 KB
testcase_28 AC 198 ms
18,464 KB
testcase_29 AC 202 ms
18,840 KB
testcase_30 AC 16 ms
7,860 KB
testcase_31 AC 138 ms
13,060 KB
testcase_32 AC 139 ms
13,164 KB
testcase_33 AC 287 ms
19,096 KB
testcase_34 AC 15 ms
7,928 KB
testcase_35 AC 16 ms
7,916 KB
testcase_36 AC 15 ms
7,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, X, Y, Z = map(int, input().split())
a = list(map(lambda x: int(x) // 1000 * 1000 + 1000, input().split()))

for i in range(N):
    if a[i] >= 10000:
        n = min(Z, a[i]//10000)
        a[i] -= n * 10000
        Z -= n

a.sort(reverse=True)

for i in range(N):
    if a[i] <= 0:
        break
    if a[i] >= 5000 and Z:
        a[i] -= 10000
        Z -= 1
        continue
    if a[i] >= 5000:
        n = min(Y, a[i]//5000)
        a[i] -= n * 5000
        Y -= n

a.sort(reverse=True)

for i in range(N):
    if a[i] <= 0:
        break
    if a[i] > 0 and Z:
        a[i] -= 10000
        Z -= 1
    if a[i] > 0 and Y:
        a[i] -= 5000
        Y -= 1
    if a[i] > 0:
        n = min(a[i] // 1000, X)
        a[i] -= 1000*n
        X -= n

print('Yes' if max(a) <= 0 else 'No')
0