結果

問題 No.1015 おつりは要らないです
ユーザー nagitaosunagitaosu
提出日時 2020-04-03 22:14:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,185 bytes
コンパイル時間 144 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 19,180 KB
最終ジャッジ日時 2023-09-16 02:19:37
合計ジャッジ時間 5,545 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,228 KB
testcase_01 AC 15 ms
8,188 KB
testcase_02 AC 16 ms
8,144 KB
testcase_03 AC 16 ms
7,904 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,868 KB
testcase_06 AC 16 ms
8,224 KB
testcase_07 AC 16 ms
8,212 KB
testcase_08 AC 17 ms
8,176 KB
testcase_09 AC 17 ms
8,136 KB
testcase_10 AC 166 ms
18,896 KB
testcase_11 AC 176 ms
18,972 KB
testcase_12 AC 162 ms
18,232 KB
testcase_13 AC 172 ms
18,628 KB
testcase_14 AC 177 ms
19,172 KB
testcase_15 AC 167 ms
18,340 KB
testcase_16 AC 168 ms
18,724 KB
testcase_17 AC 173 ms
18,972 KB
testcase_18 AC 173 ms
18,384 KB
testcase_19 AC 180 ms
18,784 KB
testcase_20 AC 151 ms
18,528 KB
testcase_21 AC 149 ms
18,420 KB
testcase_22 AC 145 ms
18,492 KB
testcase_23 AC 139 ms
18,256 KB
testcase_24 AC 146 ms
18,848 KB
testcase_25 AC 148 ms
18,476 KB
testcase_26 AC 146 ms
18,512 KB
testcase_27 AC 141 ms
18,272 KB
testcase_28 AC 140 ms
18,728 KB
testcase_29 AC 141 ms
18,772 KB
testcase_30 AC 16 ms
8,276 KB
testcase_31 AC 100 ms
10,004 KB
testcase_32 AC 97 ms
10,012 KB
testcase_33 AC 103 ms
19,180 KB
testcase_34 AC 15 ms
8,144 KB
testcase_35 AC 17 ms
8,136 KB
testcase_36 AC 16 ms
8,068 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:
    if item % 1000 != 999:
        item += 1
    pay_first += (item // 10000) * 10000
    if item % 10000 >= 5000:
        over_five.append(item % 10000)
    elif item % 10000 > 0:
        under_five.append(item % 10000)

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

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

payment = min(x*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 enumerate(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