結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,168 KB
testcase_01 AC 16 ms
8,088 KB
testcase_02 AC 16 ms
8,168 KB
testcase_03 AC 16 ms
7,828 KB
testcase_04 WA -
testcase_05 AC 17 ms
8,092 KB
testcase_06 AC 18 ms
8,364 KB
testcase_07 AC 16 ms
8,320 KB
testcase_08 AC 16 ms
8,152 KB
testcase_09 AC 16 ms
8,204 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 96 ms
18,424 KB
testcase_16 AC 104 ms
18,864 KB
testcase_17 AC 101 ms
18,872 KB
testcase_18 AC 101 ms
18,532 KB
testcase_19 AC 97 ms
18,708 KB
testcase_20 AC 144 ms
18,552 KB
testcase_21 AC 143 ms
18,584 KB
testcase_22 AC 143 ms
18,656 KB
testcase_23 AC 140 ms
18,248 KB
testcase_24 AC 146 ms
19,056 KB
testcase_25 AC 141 ms
18,464 KB
testcase_26 AC 147 ms
18,452 KB
testcase_27 AC 140 ms
18,380 KB
testcase_28 AC 139 ms
18,624 KB
testcase_29 AC 141 ms
18,752 KB
testcase_30 AC 16 ms
8,208 KB
testcase_31 AC 100 ms
10,092 KB
testcase_32 AC 100 ms
10,104 KB
testcase_33 AC 100 ms
19,076 KB
testcase_34 AC 16 ms
8,168 KB
testcase_35 AC 16 ms
7,920 KB
testcase_36 AC 16 ms
8,092 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(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 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