結果

問題 No.1015 おつりは要らないです
ユーザー konchanksukonchanksu
提出日時 2020-04-03 23:58:13
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 972 bytes
コンパイル時間 199 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,736 KB
最終ジャッジ日時 2024-04-29 01:21:41
合計ジャッジ時間 5,439 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 26 ms
10,880 KB
testcase_01 AC 29 ms
10,880 KB
testcase_02 AC 30 ms
10,752 KB
testcase_03 AC 29 ms
10,880 KB
testcase_04 AC 27 ms
10,752 KB
testcase_05 AC 26 ms
10,752 KB
testcase_06 AC 26 ms
10,752 KB
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 27 ms
10,880 KB
testcase_09 AC 26 ms
10,752 KB
testcase_10 AC 160 ms
21,284 KB
testcase_11 AC 174 ms
21,716 KB
testcase_12 AC 159 ms
20,916 KB
testcase_13 AC 157 ms
21,320 KB
testcase_14 AC 167 ms
21,568 KB
testcase_15 AC 159 ms
20,852 KB
testcase_16 AC 158 ms
21,284 KB
testcase_17 AC 172 ms
21,732 KB
testcase_18 AC 163 ms
21,240 KB
testcase_19 AC 156 ms
21,220 KB
testcase_20 AC 150 ms
21,232 KB
testcase_21 AC 155 ms
21,100 KB
testcase_22 AC 149 ms
21,280 KB
testcase_23 AC 155 ms
20,796 KB
testcase_24 AC 168 ms
21,420 KB
testcase_25 AC 154 ms
21,116 KB
testcase_26 AC 155 ms
21,128 KB
testcase_27 AC 151 ms
20,932 KB
testcase_28 AC 152 ms
20,916 KB
testcase_29 AC 155 ms
21,188 KB
testcase_30 AC 26 ms
10,880 KB
testcase_31 AC 103 ms
13,036 KB
testcase_32 AC 102 ms
12,900 KB
testcase_33 AC 96 ms
21,736 KB
testcase_34 AC 26 ms
10,752 KB
testcase_35 AC 26 ms
10,880 KB
testcase_36 AC 26 ms
10,880 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 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
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