結果

問題 No.1015 おつりは要らないです
ユーザー titiatitia
提出日時 2020-04-03 21:48:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 775 bytes
コンパイル時間 136 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 21,760 KB
最終ジャッジ日時 2024-04-29 01:12:23
合計ジャッジ時間 7,237 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
10,752 KB
testcase_01 AC 24 ms
10,624 KB
testcase_02 AC 24 ms
10,752 KB
testcase_03 AC 25 ms
10,624 KB
testcase_04 AC 26 ms
10,752 KB
testcase_05 AC 27 ms
10,624 KB
testcase_06 AC 25 ms
10,624 KB
testcase_07 AC 24 ms
10,624 KB
testcase_08 AC 28 ms
10,624 KB
testcase_09 AC 24 ms
10,624 KB
testcase_10 AC 270 ms
21,312 KB
testcase_11 AC 270 ms
21,316 KB
testcase_12 AC 258 ms
20,772 KB
testcase_13 AC 264 ms
21,040 KB
testcase_14 AC 286 ms
21,760 KB
testcase_15 AC 261 ms
20,868 KB
testcase_16 AC 265 ms
21,140 KB
testcase_17 AC 274 ms
21,624 KB
testcase_18 AC 275 ms
21,104 KB
testcase_19 AC 255 ms
21,240 KB
testcase_20 AC 256 ms
21,104 KB
testcase_21 AC 253 ms
20,848 KB
testcase_22 AC 247 ms
21,140 KB
testcase_23 AC 249 ms
20,548 KB
testcase_24 AC 259 ms
21,028 KB
testcase_25 AC 245 ms
20,892 KB
testcase_26 AC 258 ms
20,868 KB
testcase_27 AC 252 ms
20,800 KB
testcase_28 AC 241 ms
20,736 KB
testcase_29 AC 249 ms
21,260 KB
testcase_30 AC 25 ms
10,624 KB
testcase_31 AC 136 ms
12,628 KB
testcase_32 AC 131 ms
12,880 KB
testcase_33 AC 131 ms
21,604 KB
testcase_34 AC 25 ms
10,624 KB
testcase_35 AC 24 ms
10,624 KB
testcase_36 AC 24 ms
10,752 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