結果

問題 No.1015 おつりは要らないです
ユーザー ryo_nryo_n
提出日時 2020-04-03 21:35:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,910 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 11,068 KB
実行使用メモリ 19,176 KB
最終ジャッジ日時 2023-09-16 00:27:20
合計ジャッジ時間 3,756 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,188 KB
testcase_01 AC 16 ms
8,236 KB
testcase_02 AC 16 ms
8,244 KB
testcase_03 AC 16 ms
8,040 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
8,128 KB
testcase_08 AC 17 ms
8,124 KB
testcase_09 AC 16 ms
8,244 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 78 ms
18,496 KB
testcase_16 AC 81 ms
18,552 KB
testcase_17 AC 84 ms
19,096 KB
testcase_18 AC 81 ms
18,632 KB
testcase_19 AC 80 ms
18,464 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,108 KB
testcase_31 AC 41 ms
10,192 KB
testcase_32 AC 42 ms
10,180 KB
testcase_33 AC 57 ms
19,168 KB
testcase_34 AC 16 ms
8,124 KB
testcase_35 WA -
testcase_36 AC 17 ms
8,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    N, X, Y, Z = [int(x) for x in input().split()]
    A = [int(x) for x in input().split()]

    for a in A:
        if a < 1000:
            if X > 0:
                X -= 1
            else:
                if Y > 0:
                    Y -= 1
                else:
                    if Z > 0:
                        Z -= 1
                    else:
                        print("No")
                        break
        elif a < 5000:
            if Y > 0:
                Y -= 1
            else:
                if Z > 0:
                    Z -= 1
                else:
                    if X >= -(-(a + 1) // 1000):
                        X -= -(-(a + 1) // 1000)
                    else:
                        print("No")
                        break
        elif a < 10000:
            if Z > 0:
                Z -= 1
            else:
                if Y >= -(-(a + 1) // 5000):
                    Y -= -(-(a + 1) // 5000)
                else:
                    a -= 5000 * Y
                    Y = 0
                    if X >= -(-(a + 1) // 1000):
                        X -= -(-(a + 1) // 1000)
                    else:
                        print("No")
                        break
        else:
            if Z >= -(-(a + 1) // 10000):
                Z -= -(-(a + 1) // 10000)
            else:
                a -= Z * 10000
                Z = 0
                if Y >= -(-(a + 1) // 5000):
                    Y -= -(-(a + 1) // 5000)
                else:
                    a -= 5000 * Y
                    Y = 0
                    if X >= -(-(a + 1) // 1000):
                        X -= -(-(a + 1) // 1000)
                    else:
                        print("No")
                        break

    else:
        print("Yes")


if __name__ == '__main__':
    main()
0