結果

問題 No.1015 おつりは要らないです
ユーザー konchanksukonchanksu
提出日時 2020-04-03 23:57:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 979 bytes
コンパイル時間 78 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 19,608 KB
最終ジャッジ日時 2023-09-16 05:06:07
合計ジャッジ時間 5,840 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

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 Z > 0:
        if i // 10 > Z:
            tmp.append(i - 10 * Z)
            Z = 0         
        else:
            tmp.append(i % 10)
            Z -= i // 10
    else:
        tmp.append(i)

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

print(tmp)

a = tmp
tmp = []

for i in a:    
    if Y > 0:
        if i // 5 > Y:
            tmp.append(i - 5 * Y)
            Y = 0
        else:
            tmp.append(i % 5)
            Y -= i // 5
    else:
        tmp.append(i)

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

a = tmp
tmp = []

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

if X < 0:
    ans = False

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