結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,456 KB
testcase_01 AC 69 ms
71,284 KB
testcase_02 AC 68 ms
71,280 KB
testcase_03 AC 70 ms
71,436 KB
testcase_04 WA -
testcase_05 AC 69 ms
71,624 KB
testcase_06 AC 69 ms
71,572 KB
testcase_07 AC 69 ms
71,448 KB
testcase_08 AC 68 ms
71,368 KB
testcase_09 AC 70 ms
71,432 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 121 ms
102,864 KB
testcase_16 AC 122 ms
102,984 KB
testcase_17 AC 124 ms
103,000 KB
testcase_18 AC 125 ms
102,768 KB
testcase_19 AC 127 ms
102,772 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 68 ms
71,260 KB
testcase_31 AC 106 ms
101,652 KB
testcase_32 AC 109 ms
101,340 KB
testcase_33 AC 107 ms
102,284 KB
testcase_34 WA -
testcase_35 AC 71 ms
71,268 KB
testcase_36 AC 69 ms
71,328 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:
            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