結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー H3PO4H3PO4
提出日時 2021-11-12 21:49:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 707 bytes
コンパイル時間 313 ms
コンパイル使用メモリ 87,324 KB
実行使用メモリ 160,488 KB
最終ジャッジ日時 2023-08-17 00:58:09
合計ジャッジ時間 13,905 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,584 KB
testcase_01 AC 75 ms
71,140 KB
testcase_02 AC 73 ms
71,424 KB
testcase_03 WA -
testcase_04 AC 676 ms
156,064 KB
testcase_05 AC 247 ms
103,568 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 182 ms
97,272 KB
testcase_09 AC 237 ms
101,184 KB
testcase_10 AC 266 ms
91,232 KB
testcase_11 WA -
testcase_12 AC 89 ms
76,456 KB
testcase_13 WA -
testcase_14 AC 208 ms
99,124 KB
testcase_15 AC 689 ms
160,488 KB
testcase_16 AC 236 ms
89,096 KB
testcase_17 AC 373 ms
105,396 KB
testcase_18 AC 170 ms
98,224 KB
testcase_19 AC 245 ms
102,788 KB
testcase_20 WA -
testcase_21 AC 502 ms
132,488 KB
testcase_22 AC 616 ms
146,920 KB
testcase_23 AC 686 ms
142,612 KB
testcase_24 AC 269 ms
125,992 KB
testcase_25 AC 244 ms
98,340 KB
testcase_26 WA -
testcase_27 AC 246 ms
97,500 KB
testcase_28 WA -
testcase_29 AC 262 ms
101,772 KB
testcase_30 AC 683 ms
154,272 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 80 ms
76,092 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 85 ms
76,096 KB
testcase_39 AC 87 ms
76,080 KB
testcase_40 AC 85 ms
75,864 KB
testcase_41 AC 83 ms
75,988 KB
testcase_42 AC 83 ms
75,912 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, A, B, X, Y = map(int, input().split())
H = tuple(map(int, input().split()))


def solve(N, A, B, X, Y, H, K):
    Hl = list(H)
    for i in range(N):
        Hl[i] = max(Hl[i] - K, 0)

    for i in range(N):
        div = Hl[i] // X
        if div <= A:
            Hl[i] -= div * X
            A -= div
        else:
            Hl[i] -= A * X
            A = 0

    if A >= N:
        return True
    elif A:
        Hl.sort(reverse=True)
        # 前からA番目までは潰せる
        return sum(Hl[A:]) <= B * Y
    else:
        return sum(Hl) <= B * Y


l, r = 0, 10 ** 9
while r - l > 1:
    m = (r + l) // 2
    if solve(N, A, B, X, Y, H, m):
        r = m
    else:
        l = m
print(r)
0