結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,452 KB
testcase_01 AC 19 ms
8,488 KB
testcase_02 AC 19 ms
8,384 KB
testcase_03 AC 20 ms
8,484 KB
testcase_04 AC 19 ms
8,484 KB
testcase_05 AC 19 ms
8,556 KB
testcase_06 AC 20 ms
8,380 KB
testcase_07 AC 19 ms
8,484 KB
testcase_08 AC 19 ms
8,388 KB
testcase_09 AC 19 ms
8,392 KB
testcase_10 AC 211 ms
19,552 KB
testcase_11 AC 214 ms
18,972 KB
testcase_12 AC 204 ms
19,356 KB
testcase_13 AC 209 ms
18,924 KB
testcase_14 AC 221 ms
19,288 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 203 ms
19,576 KB
testcase_21 AC 199 ms
18,908 KB
testcase_22 AC 200 ms
18,988 KB
testcase_23 AC 191 ms
19,044 KB
testcase_24 AC 204 ms
19,092 KB
testcase_25 AC 200 ms
18,876 KB
testcase_26 AC 202 ms
18,888 KB
testcase_27 AC 199 ms
19,388 KB
testcase_28 AC 194 ms
18,528 KB
testcase_29 AC 201 ms
18,984 KB
testcase_30 AC 18 ms
8,448 KB
testcase_31 AC 120 ms
11,272 KB
testcase_32 AC 121 ms
11,304 KB
testcase_33 AC 158 ms
19,196 KB
testcase_34 AC 18 ms
8,444 KB
testcase_35 AC 19 ms
8,484 KB
testcase_36 AC 19 ms
8,392 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円
tmpa = copy.deepcopy(a)
tmpz = sum(list(map(lambda x:x//10, tmpa))) - Z

ans = True

# 10000円で払えなかった場合
if tmpz > 0:
    tmpz *= 2
    tmpz -= Y
    if tmpz > 0:
        tmpz *= 5
        tmpz -= X
        if tmpz > 0:
            print('No')
            ans = False
        else:
            X = abs(tmpz)
    else:
        Y = abs(tmpz)
    tmpz = 0

a = sorted(list(map(lambda x: x % 10, a)))

# 10000円が余った場合
if tmpz < 0:
    # でかいのから消去する
    a = a[:len(a) + tmpz]

tmpa = copy.deepcopy(a)
tmpy = sum(list(map(lambda x: x//5, tmpa))) - Y

if tmpy > 0:
    tmpy *= 5
    tmpy -= X
    if tmpy > 0:
        if ans:
            print('No')
        ans = False
    else:
        X = abs(tmpy)
    tmpy = 0

a = sorted(list(map(lambda x: x % 5, a)))

if tmpy < 0:
    a = a[:len(a) + tmpy]

tmpx = sum(a) - X

if ans:
    print('Yes' if tmpx <= 0 else 'No')    
0