結果

問題 No.1015 おつりは要らないです
ユーザー tachyon777tachyon777
提出日時 2020-04-03 21:46:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,277 bytes
コンパイル時間 713 ms
コンパイル使用メモリ 86,756 KB
実行使用メモリ 103,012 KB
最終ジャッジ日時 2023-09-16 00:55:10
合計ジャッジ時間 5,822 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,132 KB
testcase_01 AC 73 ms
71,120 KB
testcase_02 AC 73 ms
71,028 KB
testcase_03 AC 69 ms
70,928 KB
testcase_04 WA -
testcase_05 AC 73 ms
71,228 KB
testcase_06 AC 70 ms
71,252 KB
testcase_07 AC 74 ms
70,884 KB
testcase_08 AC 69 ms
71,232 KB
testcase_09 AC 69 ms
71,228 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 122 ms
102,708 KB
testcase_16 AC 124 ms
102,580 KB
testcase_17 AC 124 ms
102,920 KB
testcase_18 AC 122 ms
102,220 KB
testcase_19 AC 124 ms
102,416 KB
testcase_20 AC 126 ms
102,656 KB
testcase_21 AC 126 ms
102,396 KB
testcase_22 AC 125 ms
102,468 KB
testcase_23 AC 125 ms
102,468 KB
testcase_24 AC 126 ms
102,588 KB
testcase_25 AC 127 ms
102,532 KB
testcase_26 AC 126 ms
102,268 KB
testcase_27 AC 127 ms
102,180 KB
testcase_28 AC 127 ms
102,188 KB
testcase_29 AC 127 ms
102,636 KB
testcase_30 AC 70 ms
71,352 KB
testcase_31 AC 108 ms
101,092 KB
testcase_32 AC 107 ms
101,092 KB
testcase_33 AC 106 ms
101,940 KB
testcase_34 AC 71 ms
71,048 KB
testcase_35 AC 70 ms
71,144 KB
testcase_36 AC 70 ms
71,196 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 >= 1:
        res = min(gosen,i*2)
        gosen -= res
        i -= res
    
    if i > 0 and sen >= 1:
        res = min(sen,i*10)
        sen -= res
        i -= res

    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