結果

問題 No.1015 おつりは要らないです
ユーザー yosakayosaka
提出日時 2020-04-03 22:08:50
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 742 bytes
コンパイル時間 1,085 ms
コンパイル使用メモリ 87,196 KB
実行使用メモリ 93,932 KB
最終ジャッジ日時 2023-09-16 02:02:20
合計ジャッジ時間 8,905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 74 ms
71,368 KB
testcase_02 AC 74 ms
71,240 KB
testcase_03 AC 74 ms
71,492 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 73 ms
71,632 KB
testcase_08 AC 72 ms
71,548 KB
testcase_09 AC 71 ms
71,356 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 73 ms
71,408 KB
testcase_31 AC 126 ms
91,932 KB
testcase_32 AC 89 ms
88,452 KB
testcase_33 RE -
testcase_34 AC 71 ms
71,424 KB
testcase_35 AC 72 ms
71,576 KB
testcase_36 RE -
権限があれば一括ダウンロードができます

ソースコード

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