結果

問題 No.1015 おつりは要らないです
ユーザー tachyon777tachyon777
提出日時 2020-04-03 22:01:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,386 bytes
コンパイル時間 268 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 103,108 KB
最終ジャッジ日時 2023-09-16 01:36:58
合計ジャッジ時間 5,917 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 71 ms
71,248 KB
testcase_02 AC 70 ms
71,348 KB
testcase_03 AC 71 ms
71,384 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 72 ms
71,440 KB
testcase_07 AC 72 ms
71,328 KB
testcase_08 AC 71 ms
71,368 KB
testcase_09 AC 71 ms
71,328 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 130 ms
102,584 KB
testcase_16 AC 128 ms
102,748 KB
testcase_17 AC 133 ms
102,976 KB
testcase_18 AC 128 ms
102,444 KB
testcase_19 AC 128 ms
102,848 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 73 ms
71,052 KB
testcase_31 AC 112 ms
101,600 KB
testcase_32 AC 112 ms
101,288 KB
testcase_33 AC 111 ms
102,048 KB
testcase_34 WA -
testcase_35 AC 71 ms
71,388 KB
testcase_36 AC 72 ms
71,332 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:
        continue
    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 >= 5000 and gosen >= 1:
        res = 1
        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 and gosen >= 1:
        res = 1
        gosen -= res
        i -= res*5000

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

print("Yes")
0