結果

問題 No.1015 おつりは要らないです
ユーザー syosinnsya8syosinnsya8
提出日時 2020-04-03 23:10:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,157 bytes
コンパイル時間 234 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 19,272 KB
最終ジャッジ日時 2023-09-16 04:27:02
合計ジャッジ時間 6,256 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 16 ms
8,140 KB
testcase_02 AC 16 ms
8,144 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 17 ms
8,168 KB
testcase_08 AC 17 ms
8,280 KB
testcase_09 AC 17 ms
8,324 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 174 ms
18,284 KB
testcase_16 AC 177 ms
18,556 KB
testcase_17 AC 185 ms
19,032 KB
testcase_18 AC 179 ms
18,632 KB
testcase_19 AC 176 ms
18,664 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 16 ms
8,276 KB
testcase_31 AC 79 ms
10,000 KB
testcase_32 AC 80 ms
10,096 KB
testcase_33 AC 165 ms
18,904 KB
testcase_34 AC 17 ms
8,140 KB
testcase_35 WA -
testcase_36 AC 17 ms
8,204 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y,z=map(int,input().split())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    if int(a[i])>999:
        pay=int(a[i]//1000+1)
        while pay>0:
            if len(str(pay))>1:
                if pay<=z:
                    p=pay//10
                    z-=p
                    pay-=p
                if pay<=5*y:
                    p=pay//5
                    y-=p
                    pay-=p
                if pay<=x:
                    x-=pay
                    pay=-1
            else:
                if pay<=x:
                    x-=pay
                    pay=-1
                if pay<=5*y:
                    p=pay//5
                    y-=p
                    pay=-1
                if pay<=z:
                    p=pay//10
                    z-=p
                    pay=-1
            a[i]=pay
            if pay >0:
                break
    else:
        if x>0:
            x-=1
            a[i]=-1
        elif y>0:
            y-=1
            a[i]=-1
        elif z>0:
            z-=1
            a[i]=-1
        else:
            break
if all(elem < 0 for elem in a):
    print('Yes')
else:
    print('No')
0