結果

問題 No.1015 おつりは要らないです
ユーザー konchanksukonchanksu
提出日時 2020-04-03 23:47:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 902 bytes
コンパイル時間 252 ms
コンパイル使用メモリ 10,892 KB
実行使用メモリ 19,600 KB
最終ジャッジ日時 2023-09-16 05:04:41
合計ジャッジ時間 3,680 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 WA -
testcase_02 RE -
testcase_03 AC 19 ms
8,472 KB
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
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 WA -
testcase_31 AC 41 ms
10,180 KB
testcase_32 WA -
testcase_33 RE -
testcase_34 AC 19 ms
8,316 KB
testcase_35 AC 20 ms
8,400 KB
testcase_36 AC 18 ms
8,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy

# 入力
N, X, Y, Z = map(int, input().split())
a = list(map(int, input().split()))
a = [i // 1000 + 1 for i in a]
a = sorted(a, reverse=True)

# 10000円
ans = True
tmp = []

for i in a:
    if i < 10 or Z == 0:
        break
        
    if Z > 0:
        if i // 10 > Z:
            tmp += i - 10 * Z
            Z = 0         
        else:
            tmp += i % 10
            Z -= i // 10

tmp.sort()
if Z > 0:
    tmp = tmp[:len(tmp) - Z]

a = tmp
tmp = []

for i in a:
    if i < 5 or Y == 0:
        break
    
    if Y > 0:
        if i // 5 > Y:
            tmp += i - 5 * Y
            Y = 0
        else:
            tmp += i % 5
            Y -= i // 5

tmp.sort()
if Y > 0:
    tmp = tmp[:len(tmp) - Y]

a = tmp
tmp = []

for i in a:
    if X < 0:
        ans = False
        break
    
    if X > 0:
        X -= i

if X < 0:
    ans = False

print('Yes' if ans else 'No')
0