結果

問題 No.1015 おつりは要らないです
ユーザー konchanksukonchanksu
提出日時 2020-04-04 18:59:08
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 184 ms / 2,000 ms
コード長 763 bytes
コンパイル時間 82 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 21,736 KB
最終ジャッジ日時 2024-04-29 05:06:44
合計ジャッジ時間 5,654 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,752 KB
testcase_01 AC 30 ms
10,624 KB
testcase_02 AC 31 ms
10,496 KB
testcase_03 AC 29 ms
10,624 KB
testcase_04 AC 30 ms
10,624 KB
testcase_05 AC 30 ms
10,624 KB
testcase_06 AC 30 ms
10,624 KB
testcase_07 AC 29 ms
10,624 KB
testcase_08 AC 30 ms
10,624 KB
testcase_09 AC 30 ms
10,624 KB
testcase_10 AC 175 ms
21,296 KB
testcase_11 AC 180 ms
21,308 KB
testcase_12 AC 172 ms
20,916 KB
testcase_13 AC 172 ms
21,160 KB
testcase_14 AC 184 ms
21,736 KB
testcase_15 AC 175 ms
20,852 KB
testcase_16 AC 177 ms
21,136 KB
testcase_17 AC 179 ms
21,608 KB
testcase_18 AC 180 ms
21,100 KB
testcase_19 AC 180 ms
21,076 KB
testcase_20 AC 181 ms
20,964 KB
testcase_21 AC 176 ms
21,012 KB
testcase_22 AC 176 ms
21,012 KB
testcase_23 AC 175 ms
20,544 KB
testcase_24 AC 183 ms
21,408 KB
testcase_25 AC 175 ms
21,140 KB
testcase_26 AC 178 ms
20,984 KB
testcase_27 AC 175 ms
20,792 KB
testcase_28 AC 175 ms
20,724 KB
testcase_29 AC 177 ms
21,120 KB
testcase_30 AC 29 ms
10,624 KB
testcase_31 AC 110 ms
12,784 KB
testcase_32 AC 111 ms
12,656 KB
testcase_33 AC 108 ms
21,460 KB
testcase_34 AC 30 ms
10,624 KB
testcase_35 AC 31 ms
10,752 KB
testcase_36 AC 30 ms
10,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# 入力
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]

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

print('Yes' if sum(a) <= X else 'No')
0