結果

問題 No.1015 おつりは要らないです
ユーザー Kiri8128Kiri8128
提出日時 2020-04-03 21:42:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 1,835 ms
コンパイル使用メモリ 86,788 KB
実行使用メモリ 86,088 KB
最終ジャッジ日時 2023-08-11 08:38:53
合計ジャッジ時間 5,436 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,132 KB
testcase_01 AC 77 ms
71,072 KB
testcase_02 AC 70 ms
71,204 KB
testcase_03 AC 78 ms
70,944 KB
testcase_04 AC 71 ms
71,128 KB
testcase_05 AC 78 ms
71,412 KB
testcase_06 AC 71 ms
71,132 KB
testcase_07 AC 80 ms
70,932 KB
testcase_08 AC 71 ms
71,252 KB
testcase_09 AC 80 ms
71,312 KB
testcase_10 AC 90 ms
85,780 KB
testcase_11 AC 101 ms
86,088 KB
testcase_12 AC 91 ms
85,476 KB
testcase_13 AC 104 ms
85,736 KB
testcase_14 AC 94 ms
85,784 KB
testcase_15 AC 100 ms
85,528 KB
testcase_16 AC 93 ms
85,896 KB
testcase_17 AC 102 ms
85,700 KB
testcase_18 AC 93 ms
85,612 KB
testcase_19 AC 102 ms
85,584 KB
testcase_20 AC 91 ms
85,408 KB
testcase_21 AC 102 ms
85,520 KB
testcase_22 AC 93 ms
85,396 KB
testcase_23 AC 100 ms
85,448 KB
testcase_24 AC 91 ms
85,700 KB
testcase_25 AC 101 ms
85,696 KB
testcase_26 AC 90 ms
85,400 KB
testcase_27 AC 101 ms
85,316 KB
testcase_28 AC 90 ms
85,352 KB
testcase_29 AC 98 ms
85,680 KB
testcase_30 AC 70 ms
71,332 KB
testcase_31 AC 95 ms
83,656 KB
testcase_32 AC 86 ms
83,556 KB
testcase_33 AC 102 ms
86,048 KB
testcase_34 AC 72 ms
71,196 KB
testcase_35 AC 80 ms
71,300 KB
testcase_36 AC 71 ms
71,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X, Y, Z = map(int, input().split())
A = [int(a) for a in input().split()]


B = [0] * 10
C = 0
for a in A:
    b, c = a % 10000 // 1000, a // 10000
    C += c
    B[b] += 1

t = min(Z, C)
Z -= t
C -= t

for i in range(10)[::-1]:
    t = min(Z, B[i])
    B[i] -= t
    Z -= t

t = min(Y, C)
Y -= t
C -= t
B[4] += t

for i in range(10)[::-1]:
    t = min(Y, B[i])
    B[i] -= t
    Y -= t
    if i >= 5:
        B[i-5] += t

t = min(Z, C)
Z -= t
C -= t
B[8] += t

for i in range(10)[::-1]:
    t = min(X, B[i])
    B[i] -= t
    X -= t
    if i:
        B[i-1] += t

print("Yes" if sum(B) + C == 0 else "No")
0