結果

問題 No.1015 おつりは要らないです
ユーザー shikixyxshikixyx
提出日時 2020-04-03 23:26:23
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,517 bytes
コンパイル時間 245 ms
コンパイル使用メモリ 10,916 KB
実行使用メモリ 24,208 KB
最終ジャッジ日時 2023-09-16 04:56:15
合計ジャッジ時間 9,535 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,276 KB
testcase_01 AC 17 ms
8,280 KB
testcase_02 AC 16 ms
8,440 KB
testcase_03 AC 17 ms
8,472 KB
testcase_04 AC 18 ms
8,380 KB
testcase_05 AC 17 ms
8,444 KB
testcase_06 AC 16 ms
8,372 KB
testcase_07 AC 17 ms
8,332 KB
testcase_08 AC 17 ms
8,444 KB
testcase_09 AC 17 ms
8,344 KB
testcase_10 AC 339 ms
23,552 KB
testcase_11 AC 356 ms
23,768 KB
testcase_12 AC 324 ms
22,776 KB
testcase_13 AC 339 ms
23,620 KB
testcase_14 AC 361 ms
24,208 KB
testcase_15 AC 336 ms
23,172 KB
testcase_16 AC 339 ms
23,376 KB
testcase_17 AC 351 ms
23,732 KB
testcase_18 AC 335 ms
23,300 KB
testcase_19 AC 339 ms
23,284 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 17 ms
8,416 KB
testcase_31 AC 202 ms
17,684 KB
testcase_32 AC 195 ms
17,776 KB
testcase_33 AC 113 ms
21,908 KB
testcase_34 AC 16 ms
8,332 KB
testcase_35 AC 16 ms
8,296 KB
testcase_36 AC 17 ms
8,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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

for i in range(N):
    if Z == 0:
        break

    a = A[i]
    man = a // 10000
    if man == 0:
        continue
    num = man if man <= Z else Z
    A[i] -= num * 10000
    Z -= num

A.sort(key=lambda x: (x//10000, x % 10000), reverse=True)

for i in range(N):
    a = A[i]
    if Z == 0:
        break
    if a < 0:
        continue
    elif a == 0:
        a += 1

    man = -(-a // 10000)

    num = man if man <= Z else Z
    A[i] -= num * 10000
    Z -= num


for i in range(N):
    if Y == 0:
        break

    a = A[i]

    if a < 0:
        continue

    gosen = a // 5000
    if gosen == 0:
        continue
    num = gosen if gosen <= Y else Y
    A[i] -= num * 5000
    Y -= num


A.sort(key=lambda x: (x//5000, x % 5000), reverse=True)

for i in range(N):
    a = A[i]
    if Y == 0:
        break
    if a < 0:
        continue
    elif a == 0:
        a += 1

    gosen = -(-a // 5000)

    num = gosen if gosen <= Y else Y
    A[i] -= num * 5000
    Y -= num


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

    if a < 0:
        continue

    if a == 0:
        a += 1

    if X == 0:
        print('No')
        exit()

    sen = -(-a // 1000)
    num = sen if sen <= X else X
    a -= num * 1000
    X -= num

    if a >= 0:
        print('No')
        exit()


print('Yes')
exit()
0