結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,216 KB
testcase_01 AC 17 ms
8,100 KB
testcase_02 AC 18 ms
8,360 KB
testcase_03 AC 15 ms
8,172 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 80 ms
18,308 KB
testcase_16 AC 85 ms
18,432 KB
testcase_17 AC 88 ms
19,004 KB
testcase_18 AC 86 ms
18,436 KB
testcase_19 AC 84 ms
18,832 KB
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 15 ms
8,160 KB
testcase_31 AC 87 ms
10,028 KB
testcase_32 AC 87 ms
10,040 KB
testcase_33 AC 80 ms
19,112 KB
testcase_34 AC 15 ms
8,248 KB
testcase_35 RE -
testcase_36 AC 15 ms
8,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
import sys
input = sys.stdin.readline

n, x, y, z = map(int, input().split())
a = [int(item) for item in input().split()]
over_five = []
under_five = []

pay_first = 0
for item in a:
    pay_first += (item // 10000) * 10000
    if item % 10000 >= 5000:
        over_five.append(item % 10000)
    elif item % 10000 > 0:
        under_five.append(item % 10000)
    else:
        under_five.append(1)

payment = min(z*10000, pay_first)
z -= payment // 10000; pay_first -= payment

payment = min(y*5000, pay_first)
y -= payment // 50000; pay_first -= payment

payment = min(y*1000, pay_first)
x -= payment // 1000; pay_first -= payment

if pay_first > 0:
    print("No")
    exit()

over_five.sort(reverse=True)
for i, item in over_five:
    if z > 0:
        z -= 1
        continue
    if y > 0:
        y -= 1
        under_five.append(item - 5000)
    under_five.append(item)

under_five.sort(reverse=True)

for item in under_five:
    if z > 0:
        z -= 1
        continue
    if y > 0:
        y -= 1
        continue
    use = (item + 999) // 1000
    if x >= use:
        x -= use
    else:
        print("No")
        exit()
print("Yes")
0