結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,156 KB
testcase_01 AC 17 ms
8,404 KB
testcase_02 WA -
testcase_03 AC 17 ms
8,200 KB
testcase_04 AC 17 ms
8,016 KB
testcase_05 AC 17 ms
8,048 KB
testcase_06 AC 17 ms
8,012 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 120 ms
18,816 KB
testcase_11 AC 123 ms
19,092 KB
testcase_12 AC 119 ms
18,272 KB
testcase_13 AC 119 ms
18,824 KB
testcase_14 AC 127 ms
19,184 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 116 ms
18,804 KB
testcase_21 AC 114 ms
18,804 KB
testcase_22 AC 118 ms
18,708 KB
testcase_23 AC 114 ms
18,248 KB
testcase_24 AC 121 ms
18,964 KB
testcase_25 AC 119 ms
18,808 KB
testcase_26 AC 116 ms
18,760 KB
testcase_27 AC 114 ms
18,620 KB
testcase_28 AC 116 ms
18,708 KB
testcase_29 AC 119 ms
18,816 KB
testcase_30 AC 16 ms
8,504 KB
testcase_31 AC 53 ms
10,160 KB
testcase_32 AC 33 ms
10,084 KB
testcase_33 WA -
testcase_34 AC 18 ms
8,040 KB
testcase_35 AC 17 ms
8,056 KB
testcase_36 AC 17 ms
8,064 KB
権限があれば一括ダウンロードができます

ソースコード

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