結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,460 KB
testcase_01 AC 18 ms
8,500 KB
testcase_02 AC 18 ms
8,460 KB
testcase_03 AC 18 ms
8,464 KB
testcase_04 AC 18 ms
8,556 KB
testcase_05 AC 18 ms
8,580 KB
testcase_06 AC 18 ms
8,460 KB
testcase_07 AC 18 ms
8,448 KB
testcase_08 AC 18 ms
8,476 KB
testcase_09 AC 18 ms
8,412 KB
testcase_10 AC 198 ms
19,636 KB
testcase_11 AC 202 ms
19,008 KB
testcase_12 AC 187 ms
19,216 KB
testcase_13 AC 194 ms
18,980 KB
testcase_14 AC 205 ms
19,176 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 185 ms
19,728 KB
testcase_21 AC 186 ms
18,968 KB
testcase_22 AC 181 ms
18,840 KB
testcase_23 AC 178 ms
19,240 KB
testcase_24 AC 190 ms
18,980 KB
testcase_25 AC 177 ms
18,876 KB
testcase_26 AC 178 ms
18,856 KB
testcase_27 AC 180 ms
19,496 KB
testcase_28 AC 184 ms
18,728 KB
testcase_29 AC 187 ms
18,956 KB
testcase_30 AC 18 ms
8,484 KB
testcase_31 AC 120 ms
11,324 KB
testcase_32 AC 119 ms
11,296 KB
testcase_33 AC 97 ms
19,104 KB
testcase_34 AC 18 ms
8,456 KB
testcase_35 AC 19 ms
8,492 KB
testcase_36 AC 18 ms
8,460 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(map(lambda x:x//10, tmpa)) - Z

# 10000円で払えなかった場合
if tmpz > 0:
    tmpz *= 2
    tmpz -= Y
    if tmpz > 0:
        tmpz *= 5
        tmpz -= X
        if tmpz > 0:
            print('No')
            exit()
        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(map(lambda x: x//5, tmpa)) - Y

if tmpy > 0:
    tmpy *= 5
    tmpy -= X
    if tmpy > 0:
        print('No')
        exit()
    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
print('Yes' if tmpx <= 0 else 'No')    
0