結果

問題 No.1015 おつりは要らないです
ユーザー OKCH3COOHOKCH3COOH
提出日時 2020-04-10 22:29:58
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 872 bytes
コンパイル時間 765 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 18,948 KB
最終ジャッジ日時 2023-10-14 01:15:23
合計ジャッジ時間 9,106 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,788 KB
testcase_01 AC 17 ms
8,168 KB
testcase_02 AC 17 ms
8,208 KB
testcase_03 AC 16 ms
7,816 KB
testcase_04 WA -
testcase_05 AC 16 ms
7,968 KB
testcase_06 AC 17 ms
7,740 KB
testcase_07 AC 16 ms
8,200 KB
testcase_08 AC 16 ms
8,304 KB
testcase_09 AC 16 ms
8,164 KB
testcase_10 AC 205 ms
18,692 KB
testcase_11 AC 210 ms
18,768 KB
testcase_12 AC 196 ms
18,196 KB
testcase_13 AC 202 ms
18,620 KB
testcase_14 AC 215 ms
18,948 KB
testcase_15 AC 193 ms
18,120 KB
testcase_16 AC 202 ms
18,668 KB
testcase_17 AC 208 ms
18,772 KB
testcase_18 AC 202 ms
18,644 KB
testcase_19 AC 199 ms
18,544 KB
testcase_20 AC 203 ms
18,748 KB
testcase_21 AC 203 ms
18,680 KB
testcase_22 AC 200 ms
18,540 KB
testcase_23 AC 193 ms
18,116 KB
testcase_24 AC 205 ms
18,776 KB
testcase_25 AC 199 ms
18,624 KB
testcase_26 AC 199 ms
18,664 KB
testcase_27 AC 198 ms
18,448 KB
testcase_28 AC 196 ms
18,500 KB
testcase_29 AC 202 ms
18,800 KB
testcase_30 AC 16 ms
8,140 KB
testcase_31 AC 181 ms
9,996 KB
testcase_32 AC 186 ms
9,920 KB
testcase_33 AC 75 ms
18,844 KB
testcase_34 WA -
testcase_35 AC 16 ms
7,928 KB
testcase_36 AC 16 ms
7,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, sen, gosen, man = map(int, input().split())
A = list(map(int, input().split()))

def calc(a):
    if sen * 1000 + gosen * 5000 + man * 10000 <= a:
        return (-1, -1, -1)

    x = a

    m = min(man, x // 10000)
    x -= m * 10000
    g = min(gosen, x // 5000)
    x -= g * 5000
    s = min(sen, x // 1000)
    x -= s * 1000

    if x < 1000 and sen - s > 0:
        return (s + 1, g, m)
    if x < 5000 and gosen - g > 0:
        x -= 5000
        while x + 1000 < 0 and s > 0:
            x += 1000
            s -= 1
        return (s, g + 1, m)
    x -= 10000
    while x + 5000 < 0 and g > 0:
        x += 5000
        g -= 1
    while x + 1000 < 0 and s > 0:
        x += 1000
        s -= 1
    return (s, g, m + 1)

for a in A:
    x, y, z = calc(a)

    if x == -1:
        print('No')
        exit()
    sen -= x
    gosen -= y
    man -= z

print('Yes')
0