結果

問題 No.1015 おつりは要らないです
ユーザー tktk_snsntktk_snsn
提出日時 2020-04-03 22:05:55
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
AC  
実行時間 254 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 10,852 KB
実行使用メモリ 19,204 KB
最終ジャッジ日時 2023-08-11 08:42:25
合計ジャッジ時間 6,428 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,992 KB
testcase_01 AC 16 ms
8,044 KB
testcase_02 AC 16 ms
7,984 KB
testcase_03 AC 15 ms
7,992 KB
testcase_04 AC 16 ms
7,988 KB
testcase_05 AC 16 ms
7,916 KB
testcase_06 AC 16 ms
7,996 KB
testcase_07 AC 16 ms
8,020 KB
testcase_08 AC 16 ms
8,136 KB
testcase_09 AC 15 ms
7,992 KB
testcase_10 AC 241 ms
18,620 KB
testcase_11 AC 249 ms
18,740 KB
testcase_12 AC 229 ms
18,280 KB
testcase_13 AC 249 ms
18,564 KB
testcase_14 AC 254 ms
19,204 KB
testcase_15 AC 228 ms
18,424 KB
testcase_16 AC 240 ms
18,624 KB
testcase_17 AC 241 ms
18,964 KB
testcase_18 AC 231 ms
18,520 KB
testcase_19 AC 245 ms
18,604 KB
testcase_20 AC 181 ms
18,716 KB
testcase_21 AC 173 ms
18,628 KB
testcase_22 AC 181 ms
18,688 KB
testcase_23 AC 175 ms
18,152 KB
testcase_24 AC 182 ms
18,772 KB
testcase_25 AC 177 ms
18,576 KB
testcase_26 AC 183 ms
18,556 KB
testcase_27 AC 180 ms
18,588 KB
testcase_28 AC 176 ms
18,540 KB
testcase_29 AC 177 ms
18,812 KB
testcase_30 AC 16 ms
7,944 KB
testcase_31 AC 46 ms
10,024 KB
testcase_32 AC 47 ms
10,116 KB
testcase_33 AC 60 ms
18,928 KB
testcase_34 AC 16 ms
7,984 KB
testcase_35 AC 16 ms
8,008 KB
testcase_36 AC 16 ms
7,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import bisect
N, X, Y, Z = map(int, input().split())
A = list(map(int, input().split()))


def pay(yen, num):
    A.sort()
    i = bisect.bisect_left(A, yen)
    while i < len(A):
        pay = min(num, A[i] // yen)
        num -= pay
        A[i] -= yen * pay
        if num <= 0:
            return
        i += 1

    # 残ってるのはyen円以下
    A.sort()
    while A and num:
        A.pop()
        num -= 1
    return


if A and Z:
    pay(10000, Z)
if A and Y:
    pay(5000, Y)
if A and X:
    pay(1000, X)

ans = "No" if A else "Yes"
print(ans)
0