結果

問題 No.1015 おつりは要らないです
ユーザー paruf4paruf4
提出日時 2020-04-03 23:20:33
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,617 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 10,792 KB
実行使用メモリ 19,236 KB
最終ジャッジ日時 2023-09-16 04:51:38
合計ジャッジ時間 4,472 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,036 KB
testcase_01 AC 17 ms
8,432 KB
testcase_02 WA -
testcase_03 AC 17 ms
8,032 KB
testcase_04 AC 16 ms
8,076 KB
testcase_05 AC 16 ms
8,080 KB
testcase_06 AC 17 ms
8,064 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 119 ms
18,752 KB
testcase_11 AC 124 ms
18,836 KB
testcase_12 AC 115 ms
18,396 KB
testcase_13 AC 120 ms
18,776 KB
testcase_14 AC 123 ms
19,112 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 118 ms
18,904 KB
testcase_21 AC 113 ms
18,908 KB
testcase_22 AC 119 ms
18,748 KB
testcase_23 AC 112 ms
18,284 KB
testcase_24 AC 119 ms
18,916 KB
testcase_25 AC 117 ms
18,836 KB
testcase_26 AC 115 ms
18,668 KB
testcase_27 AC 112 ms
18,636 KB
testcase_28 AC 114 ms
18,540 KB
testcase_29 AC 118 ms
18,864 KB
testcase_30 AC 16 ms
8,364 KB
testcase_31 AC 52 ms
10,208 KB
testcase_32 AC 52 ms
10,184 KB
testcase_33 WA -
testcase_34 AC 16 ms
8,036 KB
testcase_35 AC 17 ms
8,092 KB
testcase_36 AC 16 ms
8,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import floor
n,x,y,z=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
for aa in a:
    if 1<=aa<1000:
        if x>0:
            x-=1
        elif y>0:
            y-=1
        elif z>0:
            z-=1
        else:
            print('No')
            exit()
    elif 1000<=aa<5000:
        d=floor(aa/1000)+1
        if x-d>0:
            x-=d
            if y>0:
                y-=1
            elif z>0:
                z-=1
            else:
                print('No')
                exit()
        elif y>0:
            y-=1
        elif z>0:
            z-=1
        else:
            print('No')
            exit()
    elif 5000<=aa<10000:
        d=floor(aa/1000)+1   
        if x-d>0:
            x-=d
            aa-=1000*d
            if aa>0:
                e=floor(aa/5000)+1
                if y-e>0:
                    y-=1
                elif z>0:
                    z-=1
                else:
                    print('No')
                    exit()
    elif aa>10000:
        d=floor(aa/1000)+1   
        if x-d>0:
            x-=d
            aa-=1000*d
            if aa>0:
                e=floor(aa/5000)+1
                if y-e>0:
                    aa-=5000*e
                    y-=e
                    if aa>0:
                        f=floor(aa/10000)+1       
                        if aa>0:
                            if z-f>0:
                                aa-=10000*f
                                z-=f
                            else:
                                print('No')
                                exit()
print('Yes')


0