結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 32 ms
10,752 KB
testcase_03 AC 32 ms
10,880 KB
testcase_04 AC 32 ms
10,752 KB
testcase_05 AC 30 ms
10,880 KB
testcase_06 AC 30 ms
10,880 KB
testcase_07 AC 30 ms
10,624 KB
testcase_08 AC 30 ms
10,880 KB
testcase_09 AC 30 ms
10,752 KB
testcase_10 AC 345 ms
21,320 KB
testcase_11 AC 337 ms
21,432 KB
testcase_12 AC 330 ms
20,936 KB
testcase_13 AC 342 ms
21,036 KB
testcase_14 AC 347 ms
21,760 KB
testcase_15 AC 331 ms
21,124 KB
testcase_16 AC 333 ms
21,304 KB
testcase_17 AC 342 ms
21,632 KB
testcase_18 AC 337 ms
21,236 KB
testcase_19 AC 330 ms
21,120 KB
testcase_20 AC 250 ms
20,980 KB
testcase_21 AC 249 ms
21,020 KB
testcase_22 AC 249 ms
21,020 KB
testcase_23 AC 241 ms
20,672 KB
testcase_24 AC 252 ms
21,032 KB
testcase_25 AC 249 ms
21,020 KB
testcase_26 AC 248 ms
21,000 KB
testcase_27 AC 242 ms
20,676 KB
testcase_28 AC 260 ms
20,996 KB
testcase_29 AC 251 ms
21,140 KB
testcase_30 AC 30 ms
10,752 KB
testcase_31 AC 171 ms
15,744 KB
testcase_32 AC 181 ms
15,740 KB
testcase_33 AC 366 ms
21,476 KB
testcase_34 AC 31 ms
10,624 KB
testcase_35 AC 32 ms
10,752 KB
testcase_36 AC 31 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N, X, Y, Z = map(int, input().split())
a = list(map(lambda x: int(x) // 1000 * 1000 + 1000, input().split()))

for i in range(N):
    if a[i] >= 10000:
        n = min(Z, a[i]//10000)
        a[i] -= n * 10000
        Z -= n

a.sort(reverse=True)

for i in range(N):
    if a[i] <= 0:
        break
    if a[i] >= 5000 and Z:
        a[i] -= 10000
        Z -= 1
        continue
    if a[i] >= 5000:
        n = min(Y, a[i]//5000)
        a[i] -= n * 5000
        Y -= n

a.sort(reverse=True)

for i in range(N):
    if a[i] <= 0:
        break
    if a[i] > 0 and Z:
        a[i] -= 10000
        Z -= 1
    if a[i] > 0 and Y:
        a[i] -= 5000
        Y -= 1
    if a[i] > 0:
        n = min(a[i] // 1000, X)
        a[i] -= 1000*n
        X -= n

print('Yes' if max(a) <= 0 else 'No')
0