結果

問題 No.1015 おつりは要らないです
ユーザー tktk_snsntktk_snsn
提出日時 2020-04-03 22:05:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 260 ms / 2,000 ms
コード長 560 bytes
コンパイル時間 112 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 21,852 KB
最終ジャッジ日時 2024-04-29 01:14:50
合計ジャッジ時間 6,313 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,624 KB
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 34 ms
10,880 KB
testcase_03 AC 31 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,624 KB
testcase_08 AC 31 ms
10,752 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 245 ms
21,276 KB
testcase_11 AC 256 ms
21,420 KB
testcase_12 AC 234 ms
21,024 KB
testcase_13 AC 246 ms
21,256 KB
testcase_14 AC 260 ms
21,852 KB
testcase_15 AC 236 ms
21,088 KB
testcase_16 AC 239 ms
21,400 KB
testcase_17 AC 247 ms
21,588 KB
testcase_18 AC 243 ms
21,068 KB
testcase_19 AC 243 ms
21,080 KB
testcase_20 AC 190 ms
21,064 KB
testcase_21 AC 187 ms
20,976 KB
testcase_22 AC 186 ms
20,976 KB
testcase_23 AC 179 ms
20,768 KB
testcase_24 AC 188 ms
21,120 KB
testcase_25 AC 184 ms
21,108 KB
testcase_26 AC 185 ms
21,084 KB
testcase_27 AC 190 ms
20,768 KB
testcase_28 AC 186 ms
20,832 KB
testcase_29 AC 185 ms
21,092 KB
testcase_30 AC 30 ms
10,624 KB
testcase_31 AC 59 ms
12,536 KB
testcase_32 AC 60 ms
12,540 KB
testcase_33 AC 79 ms
21,564 KB
testcase_34 AC 31 ms
10,624 KB
testcase_35 AC 30 ms
10,624 KB
testcase_36 AC 30 ms
10,752 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