結果

問題 No.1736 Princess vs. Dragoness
ユーザー ThetaTheta
提出日時 2022-10-26 19:09:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,109 bytes
コンパイル時間 79 ms
コンパイル使用メモリ 10,812 KB
実行使用メモリ 8,880 KB
最終ジャッジ日時 2023-09-17 12:02:29
合計ジャッジ時間 2,063 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
8,300 KB
testcase_01 AC 18 ms
8,440 KB
testcase_02 AC 17 ms
8,320 KB
testcase_03 WA -
testcase_04 AC 17 ms
8,620 KB
testcase_05 AC 17 ms
8,248 KB
testcase_06 AC 18 ms
8,480 KB
testcase_07 AC 18 ms
8,784 KB
testcase_08 AC 17 ms
8,432 KB
testcase_09 AC 19 ms
8,596 KB
testcase_10 AC 17 ms
8,244 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 18 ms
8,776 KB
testcase_14 WA -
testcase_15 AC 17 ms
8,524 KB
testcase_16 AC 17 ms
8,436 KB
testcase_17 WA -
testcase_18 AC 18 ms
8,632 KB
testcase_19 AC 18 ms
8,568 KB
testcase_20 AC 18 ms
8,472 KB
testcase_21 WA -
testcase_22 AC 18 ms
8,652 KB
testcase_23 AC 18 ms
8,812 KB
testcase_24 AC 17 ms
8,468 KB
testcase_25 AC 18 ms
8,480 KB
testcase_26 AC 18 ms
8,764 KB
testcase_27 AC 19 ms
8,824 KB
testcase_28 AC 18 ms
8,596 KB
testcase_29 AC 18 ms
8,708 KB
testcase_30 AC 18 ms
8,640 KB
testcase_31 AC 18 ms
8,648 KB
testcase_32 AC 18 ms
8,720 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import bisect_right
from itertools import accumulate
from math import ceil


def main():
    N, A, B, X, Y = map(int, input().split())
    H = list(map(int, input().split()))
    H_partial_sum = list(accumulate(H))
    used_num_of_magic_A = list(map(lambda num: ceil(num // X), H))
    sum_used_num_of_magic_A_reversed = list(accumulate(
        reversed(used_num_of_magic_A)))

    magic_B_kill_idx = bisect_right(H_partial_sum, Y*B)
    magic_A_kill_idx = N - bisect_right(sum_used_num_of_magic_A_reversed, A)

    if magic_B_kill_idx >= magic_A_kill_idx:
        print("Yes")
        return

    if magic_B_kill_idx + 1 < magic_A_kill_idx:
        print("No")
        return
    try:
        magic_B_rest = Y*B - H_partial_sum[magic_B_kill_idx-1]
    except IndexError:
        magic_B_rest = Y*B
    try:
        magic_A_rest_num = A - used_num_of_magic_A[N - magic_A_kill_idx - 1]
    except IndexError:
        magic_A_rest_num = A

    if magic_B_rest + magic_A_rest_num * X >= H[magic_B_kill_idx]:
        print("Yes")
    else:
        print("No")


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