結果

問題 No.1015 おつりは要らないです
ユーザー KyoroidKyoroid
提出日時 2020-04-03 21:42:42
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 704 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 10,972 KB
実行使用メモリ 19,044 KB
最終ジャッジ日時 2023-09-16 00:43:32
合計ジャッジ時間 4,696 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,836 KB
testcase_01 AC 15 ms
7,752 KB
testcase_02 AC 16 ms
7,832 KB
testcase_03 AC 17 ms
7,784 KB
testcase_04 AC 18 ms
7,832 KB
testcase_05 WA -
testcase_06 AC 17 ms
7,824 KB
testcase_07 AC 15 ms
7,824 KB
testcase_08 AC 16 ms
7,820 KB
testcase_09 AC 16 ms
7,788 KB
testcase_10 AC 121 ms
18,568 KB
testcase_11 AC 126 ms
18,724 KB
testcase_12 AC 118 ms
18,060 KB
testcase_13 AC 122 ms
18,740 KB
testcase_14 AC 127 ms
18,968 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
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 16 ms
7,896 KB
testcase_31 AC 76 ms
9,940 KB
testcase_32 AC 75 ms
10,076 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 16 ms
7,848 KB
testcase_36 AC 16 ms
7,796 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def read():
    N, X, Y, Z = list(map(int, input().split()))
    A = list(map(int, input().split()))
    return N, X, Y, Z, A


def pay(a, x, y, z):
    nz = a // 10000
    ny = (a - 10000 * nz) // 5000
    nx = (a - 10000 * nz - 5000 * ny) // 1000
    if x > 0:
        nx += 1
    elif y > 0:
        ny += 1
    elif z > 0:
        nz += 1
    else:
        return -1, -1, -1
    return nx, ny, nz


def solve(N, X, Y, Z, A):
    A = sorted(A, reverse=True)
    for a in A:
        nx, ny, nz = pay(a, X, Y, Z)
        if nx < 0:
            return "No"
        X -= nx
        Y -= ny
        Z -= nz
    return "Yes"


if __name__ == "__main__":
    inputs = read()
    print("%s" % solve(*inputs))
0