結果

問題 No.1015 おつりは要らないです
ユーザー c-yanc-yan
提出日時 2020-04-03 22:01:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,080 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 23,388 KB
最終ジャッジ日時 2023-09-16 01:35:49
合計ジャッジ時間 9,465 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,952 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 16 ms
8,260 KB
testcase_04 AC 17 ms
8,156 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
8,168 KB
testcase_08 AC 16 ms
8,148 KB
testcase_09 AC 16 ms
8,256 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 WA -
testcase_31 AC 96 ms
11,432 KB
testcase_32 AC 100 ms
11,456 KB
testcase_33 TLE -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N, X, Y, Z = map(int, input().split())
A = list(map(int, input().split()))

A = [a + 1 for a in A]
A.sort(reverse=True)
for i in range(N):
    if A[i] > 10000:
        t = A[i] // 10000
        t = min(t, Z)
        Z -= t
        A[i] -= t * 10000
        if Z == 0:
            break
    else:
        break
A = [a for a in A if a > 0]
A.sort(reverse=True)
for i in range(N):
    if A[i] > 5000:
        t = A[i] // 5000
        t = min(t, Y)
        Y -= t
        A[i] -= t * 5000
        if Y == 0:
            break
    else:
        break
A = [a for a in A if a > 0]
A.sort(reverse=True)
for i in range(N):
    if A[i] <= 1000:
        X -= 1
        A[i] -= 1000
        if X == 0:
            break
A = [a for a in A if a > 0]
A.sort(reverse=True)
i = 0
while i < len(A):
    if A[i] <= 0:
        i += 1
        continue
    if Z != 0:
        Z -= 1
        A[i] -= 10000
        continue
    elif Y != 0:
        Y -= 1
        A[i] -= 5000
        continue
    elif X != 0:
        X -= 1
        A[i] -= 1000
        continue
    print('No')
    exit()
print('Yes')
0