結果

問題 No.1015 おつりは要らないです
ユーザー shikixyxshikixyx
提出日時 2020-04-03 22:43:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,271 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 10,884 KB
実行使用メモリ 19,080 KB
最終ジャッジ日時 2023-09-16 03:46:00
合計ジャッジ時間 6,536 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,280 KB
testcase_01 AC 16 ms
8,188 KB
testcase_02 AC 16 ms
8,136 KB
testcase_03 AC 16 ms
8,224 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
8,136 KB
testcase_08 AC 16 ms
8,196 KB
testcase_09 AC 17 ms
8,220 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 186 ms
18,424 KB
testcase_16 AC 195 ms
18,668 KB
testcase_17 AC 203 ms
18,904 KB
testcase_18 AC 191 ms
18,612 KB
testcase_19 AC 190 ms
18,564 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,280 KB
testcase_31 WA -
testcase_32 AC 126 ms
10,108 KB
testcase_33 AC 61 ms
18,968 KB
testcase_34 WA -
testcase_35 AC 16 ms
8,288 KB
testcase_36 AC 17 ms
8,332 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()))
A.sort()

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


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

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

A.sort(reverse=True)

#print("A", A)
#print("XYZ", X, Y, Z)

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

    if a == 0:
        a = 1

    if Z > 0:
        man = -(-a // 10000)
        num = man if man <= Z else Z
        a -= num * 10000
        Z -= num

    if a > 0 and Y > 0:
        gosen = -(-a // 5000)
        num = gosen if gosen <= Y else Y
        a -= num * 5000
        Y -= num

    if a > 0 and X > 0:
        sen = -(-a // 1000)
        num = sen if X <= sen else X
        a -= num * 1000
        X -= num

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

    if X < 0 or Y < 0 or Z < 0:
        print('No')
        exit()

print('Yes')
exit()
0