結果

問題 No.1015 おつりは要らないです
ユーザー c-yanc-yan
提出日時 2020-04-03 22:24:21
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 1,419 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,848 KB
実行使用メモリ 19,204 KB
最終ジャッジ日時 2023-09-16 03:01:46
合計ジャッジ時間 6,539 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,204 KB
testcase_01 AC 16 ms
8,072 KB
testcase_02 AC 17 ms
8,036 KB
testcase_03 AC 17 ms
8,104 KB
testcase_04 RE -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 16 ms
8,016 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 16 ms
8,204 KB
testcase_31 AC 75 ms
10,452 KB
testcase_32 AC 74 ms
10,500 KB
testcase_33 RE -
testcase_34 AC 16 ms
8,180 KB
testcase_35 RE -
testcase_36 AC 16 ms
7,968 KB
権限があれば一括ダウンロードができます

ソースコード

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 Z == 0:
        break
    if A[i] >= 10000:
        t = A[i] // 10000
        t = min(t, Z)
        Z -= t
        A[i] -= t * 10000
    else:
        break
A = [a for a in A if a > 0]
A.sort(reverse=True)
for i in range(N):
    if Y == 0:
        break
    if A[i] >= 5000:
        t = A[i] // 5000
        t = min(t, Y)
        Y -= t
        A[i] -= t * 5000
    else:
        break
A = [a for a in A if a > 0]
A.sort(reverse=True)
for i in range(N):
    if X == 0:
        break
    if A[i] <= 1000:
        X -= 1
        A[i] -= 1000
A = [a for a in A if a > 0]
A.sort(reverse=True)

while A:
    if Z == 0:
        break
    for i in range(N):
        if Z == 0:
            break
        A[i] -= 10000
        Z -= 1
    A = [a for a in A if a > 0]
    A.sort(reverse=True)

while A:
    if Y == 0:
        break
    for i in range(N):
        if Y == 0:
            break
        A[i] -= 5000
        Y -= 1
    A = [a for a in A if a > 0]
    A.sort(reverse=True)

while A:
    if X == 0:
        break
    for i in range(N):
        if X == 0:
            break
        t = A[i] // 1000
        t = min(t, X)
        Y -= X
        A[i] -= t * 1000
    A = [a for a in A if a > 0]
    A.sort(reverse=True)

if len(A) == 0:
    print('Yes')
else:
    print('No')
0