結果

問題 No.1015 おつりは要らないです
ユーザー Kiri8128Kiri8128
提出日時 2020-04-03 21:42:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 610 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 77,312 KB
最終ジャッジ日時 2024-04-29 01:11:21
合計ジャッジ時間 3,641 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
51,968 KB
testcase_01 AC 41 ms
51,840 KB
testcase_02 AC 41 ms
52,096 KB
testcase_03 AC 41 ms
51,840 KB
testcase_04 AC 42 ms
51,840 KB
testcase_05 AC 41 ms
52,352 KB
testcase_06 AC 42 ms
51,840 KB
testcase_07 AC 41 ms
51,968 KB
testcase_08 AC 42 ms
52,352 KB
testcase_09 AC 40 ms
51,712 KB
testcase_10 AC 69 ms
76,288 KB
testcase_11 AC 70 ms
76,544 KB
testcase_12 AC 69 ms
76,032 KB
testcase_13 AC 69 ms
76,416 KB
testcase_14 AC 69 ms
76,800 KB
testcase_15 AC 69 ms
76,032 KB
testcase_16 AC 69 ms
76,288 KB
testcase_17 AC 69 ms
76,544 KB
testcase_18 AC 68 ms
76,416 KB
testcase_19 AC 69 ms
75,904 KB
testcase_20 AC 69 ms
75,776 KB
testcase_21 AC 69 ms
75,776 KB
testcase_22 AC 68 ms
76,032 KB
testcase_23 AC 68 ms
75,520 KB
testcase_24 AC 69 ms
76,160 KB
testcase_25 AC 68 ms
75,648 KB
testcase_26 AC 68 ms
75,520 KB
testcase_27 AC 68 ms
75,520 KB
testcase_28 AC 68 ms
75,392 KB
testcase_29 AC 67 ms
75,904 KB
testcase_30 AC 41 ms
52,096 KB
testcase_31 AC 60 ms
70,656 KB
testcase_32 AC 61 ms
71,040 KB
testcase_33 AC 72 ms
77,312 KB
testcase_34 AC 40 ms
51,712 KB
testcase_35 AC 41 ms
52,224 KB
testcase_36 AC 42 ms
51,968 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