結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 17 ms
8,268 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
8,376 KB
testcase_08 AC 16 ms
8,292 KB
testcase_09 AC 17 ms
8,452 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 67 ms
18,332 KB
testcase_16 AC 69 ms
18,776 KB
testcase_17 AC 70 ms
19,004 KB
testcase_18 AC 69 ms
18,768 KB
testcase_19 AC 68 ms
18,812 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 17 ms
8,364 KB
testcase_31 AC 52 ms
10,184 KB
testcase_32 AC 54 ms
10,124 KB
testcase_33 AC 49 ms
18,968 KB
testcase_34 AC 17 ms
8,016 KB
testcase_35 WA -
testcase_36 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import floor
n,x,y,z=map(int,input().split())
a=list(map(int,input().split()))
a.sort()

if len(a)<x+y+z:
    print('No')
    exit()
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