結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,436 KB
testcase_01 AC 17 ms
8,220 KB
testcase_02 AC 17 ms
7,992 KB
testcase_03 AC 16 ms
7,920 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,892 KB
testcase_06 AC 17 ms
7,936 KB
testcase_07 AC 17 ms
8,056 KB
testcase_08 AC 15 ms
7,932 KB
testcase_09 AC 16 ms
7,868 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 = []
V += [1000 for _ in range(X)]
V += [5000 for _ in range(Y)]
V += [10000 for _ in range(Z)]
L = []
for i in range(N):
    v = A[i]
    flag = False
    while v >= 0 and V:
        idx = bisect_left(V, v)
        if idx == len(V):
            idx -= 1
        v -= V[idx]
        V.pop(idx)
    if v < 0:
        flag = True
    L.append(flag)
print("Yes" if sum(L) == N else "No")
0