結果

問題 No.1015 おつりは要らないです
ユーザー tachyon777tachyon777
提出日時 2020-04-03 22:23:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,361 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 86,900 KB
実行使用メモリ 103,776 KB
最終ジャッジ日時 2023-09-16 02:40:09
合計ジャッジ時間 8,283 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,172 KB
testcase_01 AC 78 ms
71,132 KB
testcase_02 AC 75 ms
71,400 KB
testcase_03 AC 76 ms
71,380 KB
testcase_04 WA -
testcase_05 AC 75 ms
71,272 KB
testcase_06 AC 76 ms
71,184 KB
testcase_07 AC 75 ms
71,288 KB
testcase_08 AC 73 ms
71,312 KB
testcase_09 AC 75 ms
71,468 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 122 ms
103,268 KB
testcase_16 AC 124 ms
103,356 KB
testcase_17 AC 126 ms
103,544 KB
testcase_18 AC 124 ms
103,136 KB
testcase_19 AC 124 ms
103,504 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 71 ms
71,348 KB
testcase_31 AC 106 ms
101,880 KB
testcase_32 AC 108 ms
102,072 KB
testcase_33 AC 108 ms
102,272 KB
testcase_34 WA -
testcase_35 AC 70 ms
71,456 KB
testcase_36 TLE -
権限があれば一括ダウンロードができます

ソースコード

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)
thresh = 0
while man:
    man -= 1
    thresh += 1

if thresh >= len(lst3):
    print("Yes")
    exit()

lst3 = lst3[thresh:]
for i in lst3:
    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