結果

問題 No.1015 おつりは要らないです
ユーザー titiatitia
提出日時 2020-04-03 21:48:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 775 bytes
コンパイル時間 110 ms
コンパイル使用メモリ 10,896 KB
実行使用メモリ 19,264 KB
最終ジャッジ日時 2023-08-11 08:40:02
合計ジャッジ時間 7,814 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,936 KB
testcase_01 AC 19 ms
8,000 KB
testcase_02 AC 16 ms
8,104 KB
testcase_03 AC 15 ms
8,140 KB
testcase_04 AC 15 ms
8,048 KB
testcase_05 AC 16 ms
8,052 KB
testcase_06 AC 16 ms
8,044 KB
testcase_07 AC 16 ms
8,120 KB
testcase_08 AC 16 ms
8,108 KB
testcase_09 AC 16 ms
7,972 KB
testcase_10 AC 272 ms
18,512 KB
testcase_11 AC 280 ms
18,964 KB
testcase_12 AC 269 ms
18,340 KB
testcase_13 AC 274 ms
18,624 KB
testcase_14 AC 284 ms
19,196 KB
testcase_15 AC 263 ms
18,352 KB
testcase_16 AC 262 ms
18,584 KB
testcase_17 AC 269 ms
18,980 KB
testcase_18 AC 259 ms
18,412 KB
testcase_19 AC 257 ms
18,548 KB
testcase_20 AC 250 ms
18,624 KB
testcase_21 AC 249 ms
18,452 KB
testcase_22 AC 248 ms
18,556 KB
testcase_23 AC 237 ms
18,316 KB
testcase_24 AC 258 ms
19,008 KB
testcase_25 AC 253 ms
18,684 KB
testcase_26 AC 249 ms
18,656 KB
testcase_27 AC 250 ms
18,400 KB
testcase_28 AC 244 ms
18,580 KB
testcase_29 AC 259 ms
18,552 KB
testcase_30 AC 15 ms
8,164 KB
testcase_31 AC 126 ms
10,212 KB
testcase_32 AC 124 ms
10,268 KB
testcase_33 AC 117 ms
19,264 KB
testcase_34 AC 16 ms
8,024 KB
testcase_35 AC 15 ms
8,052 KB
testcase_36 AC 16 ms
8,072 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,X,Y,Z=map(int,input().split())
A=list(map(int,input().split()))

A.sort(reverse=True)

for i in range(N):
    A[i]+=1

    if A[i]>=10000 and Z>0:
        s=min(A[i]//10000,Z)
        Z-=s
        A[i]-=s*10000

A.sort(reverse=True)

for i in range(N):
    if A[i]>0 and Z>0:
        Z-=1
        A[i]=0

for i in range(N):
    if A[i]>=5000 and Y>0:
        s=min(A[i]//5000,Y)
        Y-=s
        A[i]-=s*5000

A.sort(reverse=True)

if Y>0:
    for i in range(N):
        if A[i]>0 and Y>0:
            Y-=1
            A[i]=0

for i in range(N):
    if A[i]>0 and X>0:
        s=min((A[i]+999)//1000,X)
        X-=s
        A[i]-=s*1000

if max(A)==0:
    print("Yes")
else:
    print("No")
    
    
    

    
        
        
0