結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
8,152 KB
testcase_01 AC 16 ms
8,148 KB
testcase_02 AC 16 ms
8,148 KB
testcase_03 AC 17 ms
8,212 KB
testcase_04 WA -
testcase_05 AC 16 ms
8,076 KB
testcase_06 AC 16 ms
8,372 KB
testcase_07 AC 16 ms
8,192 KB
testcase_08 AC 17 ms
8,236 KB
testcase_09 AC 16 ms
8,292 KB
testcase_10 AC 172 ms
18,788 KB
testcase_11 AC 177 ms
18,916 KB
testcase_12 AC 166 ms
18,328 KB
testcase_13 AC 175 ms
18,492 KB
testcase_14 AC 179 ms
19,060 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 140 ms
18,580 KB
testcase_21 AC 142 ms
18,596 KB
testcase_22 AC 141 ms
18,516 KB
testcase_23 AC 134 ms
18,416 KB
testcase_24 AC 142 ms
18,948 KB
testcase_25 AC 144 ms
18,556 KB
testcase_26 AC 146 ms
18,424 KB
testcase_27 AC 138 ms
18,424 KB
testcase_28 AC 136 ms
18,616 KB
testcase_29 AC 144 ms
18,752 KB
testcase_30 AC 16 ms
8,200 KB
testcase_31 AC 102 ms
10,104 KB
testcase_32 AC 102 ms
9,988 KB
testcase_33 AC 98 ms
19,040 KB
testcase_34 AC 16 ms
8,168 KB
testcase_35 AC 17 ms
8,272 KB
testcase_36 AC 15 ms
8,212 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 // 50000; 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