結果

問題 No.1015 おつりは要らないです
ユーザー lemondolemondo
提出日時 2020-12-22 15:16:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 133 ms / 2,000 ms
コード長 870 bytes
コンパイル時間 194 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 104,704 KB
最終ジャッジ日時 2024-04-29 06:21:15
合計ジャッジ時間 5,020 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,224 KB
testcase_01 AC 41 ms
51,840 KB
testcase_02 AC 41 ms
51,968 KB
testcase_03 AC 43 ms
52,224 KB
testcase_04 AC 41 ms
51,712 KB
testcase_05 AC 40 ms
51,712 KB
testcase_06 AC 41 ms
51,840 KB
testcase_07 AC 40 ms
51,840 KB
testcase_08 AC 41 ms
51,840 KB
testcase_09 AC 40 ms
52,096 KB
testcase_10 AC 131 ms
104,064 KB
testcase_11 AC 130 ms
103,040 KB
testcase_12 AC 129 ms
103,296 KB
testcase_13 AC 133 ms
103,808 KB
testcase_14 AC 132 ms
103,296 KB
testcase_15 AC 129 ms
103,680 KB
testcase_16 AC 131 ms
103,680 KB
testcase_17 AC 132 ms
104,064 KB
testcase_18 AC 129 ms
103,680 KB
testcase_19 AC 132 ms
103,680 KB
testcase_20 AC 125 ms
104,704 KB
testcase_21 AC 121 ms
103,296 KB
testcase_22 AC 122 ms
103,424 KB
testcase_23 AC 122 ms
103,424 KB
testcase_24 AC 123 ms
104,576 KB
testcase_25 AC 122 ms
103,680 KB
testcase_26 AC 122 ms
103,424 KB
testcase_27 AC 123 ms
103,424 KB
testcase_28 AC 121 ms
103,424 KB
testcase_29 AC 123 ms
103,680 KB
testcase_30 AC 41 ms
52,608 KB
testcase_31 AC 95 ms
102,016 KB
testcase_32 AC 95 ms
101,504 KB
testcase_33 AC 106 ms
104,448 KB
testcase_34 AC 41 ms
52,480 KB
testcase_35 AC 40 ms
51,712 KB
testcase_36 AC 40 ms
51,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return list(map(int, input().split()))
sys.setrecursionlimit(10**9)

N, X, Y, Z= mapint()
As = mapint()

nx = []
for a in As:
    if Z and a>=10000:
        pay = min(a//10000, Z)
        a -= pay*10000
        Z -= pay
    nx.append(a)

As = nx
As.sort(reverse=True)
nx = []
for a in As:
    if Z:
        Z -= 1
    else:
        nx.append(a)

As = nx
nx = []
for a in As:
    if Y and a>=5000:
        pay = min(a//5000, Y)
        a -= pay*5000
        Y -= pay
    nx.append(a)

As = nx
As.sort(reverse=True)
nx = []
for a in As:
    if Z:
        Z -= 1
    elif Y:
        Y -= 1
    else:
        nx.append(a)

As = nx
for a in As:
    a += 1
    pay = min(-(-a//1000), X)
    a = max(0, a-pay*1000)
    X -= pay
    if a!=0:
        print('No')
        exit()
else:
    print('Yes')
    
0