結果

問題 No.1015 おつりは要らないです
ユーザー tachyon777tachyon777
提出日時 2020-04-03 22:16:08
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,285 bytes
コンパイル時間 292 ms
コンパイル使用メモリ 87,124 KB
実行使用メモリ 103,120 KB
最終ジャッジ日時 2023-09-16 02:23:30
合計ジャッジ時間 5,736 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,020 KB
testcase_01 AC 72 ms
71,280 KB
testcase_02 AC 72 ms
71,356 KB
testcase_03 AC 71 ms
71,384 KB
testcase_04 WA -
testcase_05 AC 73 ms
71,520 KB
testcase_06 AC 73 ms
71,384 KB
testcase_07 AC 72 ms
71,336 KB
testcase_08 AC 75 ms
71,252 KB
testcase_09 AC 74 ms
71,396 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 127 ms
102,624 KB
testcase_16 AC 130 ms
102,496 KB
testcase_17 AC 129 ms
102,668 KB
testcase_18 AC 129 ms
102,616 KB
testcase_19 AC 125 ms
102,688 KB
testcase_20 AC 132 ms
102,624 KB
testcase_21 AC 130 ms
102,600 KB
testcase_22 AC 129 ms
102,588 KB
testcase_23 AC 135 ms
102,488 KB
testcase_24 AC 131 ms
102,852 KB
testcase_25 AC 128 ms
102,272 KB
testcase_26 AC 128 ms
102,432 KB
testcase_27 AC 129 ms
102,576 KB
testcase_28 AC 130 ms
102,648 KB
testcase_29 AC 129 ms
102,524 KB
testcase_30 AC 72 ms
71,016 KB
testcase_31 AC 110 ms
101,528 KB
testcase_32 AC 110 ms
101,412 KB
testcase_33 AC 107 ms
102,348 KB
testcase_34 AC 73 ms
71,564 KB
testcase_35 AC 72 ms
71,016 KB
testcase_36 AC 72 ms
71,444 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0

n,sen,gosen,man = map(int,readline().split())
lst1 = list(map(int,readline().split()))

lst2 = []
lst3 = []

for i in lst1:
    i = i+1
    lst2.append(i//10000)
    lst3.append(i%10000)

#lst2の処理
for i in lst2:
    if i > 0 and man >= 1:
        res = min(man,i)
        man -= res
        i -= res
    
    if i > 0 and gosen >= 2:
        res = min(gosen,i*2)
        gosen -= res
        i -= res//2
    
    if i > 0 and sen >= 10:
        res = min(sen,i*10)
        sen -= res
        i -= res//10

    if i > 0:
        print("No")
        exit()

#lst3の処理
#lst3が1000の場合、1000を支払えばよいが、1001の場合は2000必要
lst3.sort(reverse=True)
for i in lst3:
    if i > 0 and man >= 1:
        res = 1
        man -= 1
        i -= res*10000
    
    if i > 0 and gosen >= 1:
        res = 1 if i <= 5000 else 2
        gosen -= res
        i -= res*5000
    
    if i > 0 and sen >= 1:
        for j in range(10):
            if i <= j*1000:
                res = j
                break
        if sen < res:
            print("No")
            exit()
        sen -= res
        i -= res*1000

    if i > 0:
        print("No")
        exit()

print("Yes")
0