結果

問題 No.1015 おつりは要らないです
ユーザー yosakayosaka
提出日時 2020-04-03 22:03:46
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,860 KB
実行使用メモリ 737,312 KB
最終ジャッジ日時 2023-09-16 01:41:22
合計ジャッジ時間 4,432 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 17 ms
8,160 KB
testcase_02 AC 16 ms
7,960 KB
testcase_03 AC 17 ms
7,976 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 17 ms
7,968 KB
testcase_08 AC 17 ms
7,956 KB
testcase_09 AC 15 ms
8,128 KB
testcase_10 MLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
from bisect import bisect_left
N, X, Y, Z = map(int, input().split())
A = list(map(int, input().split()))
A.sort(reverse=True)
if X+Y+Z < N:
    print("No")
    exit()
V = [1000, 5000, 10000]
V += [1 for _ in range(X)]
V += [5 for _ in range(Y)]
V += [10 for _ in range(Z)]
L = []
for i in range(N):
    v = A[i]
    flag = False
    while v >= 0:
        idx = bisect_left(V, v)
        if idx == 3:
            idx -= 1
        if Z > 0:
            Z -= 1
            v -= 10000
        elif Y > 0:
            Y -= 1
            v -= 5000
        elif X > 0:
            X -= 1
            v -= 1000
        else:
            break
    if v < 0:
        flag = True
    L.append(flag)
print("Yes" if sum(L) == N else "No")
0