結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー kaeru82433413kaeru82433413
提出日時 2021-11-12 21:48:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,126 ms / 3,000 ms
コード長 512 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 109,312 KB
最終ジャッジ日時 2023-08-17 00:54:48
合計ジャッジ時間 38,634 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,400 KB
testcase_01 AC 83 ms
71,272 KB
testcase_02 AC 78 ms
71,412 KB
testcase_03 AC 93 ms
75,856 KB
testcase_04 AC 1,592 ms
108,540 KB
testcase_05 AC 1,954 ms
109,312 KB
testcase_06 AC 1,129 ms
107,600 KB
testcase_07 AC 87 ms
76,384 KB
testcase_08 AC 318 ms
95,480 KB
testcase_09 AC 441 ms
104,504 KB
testcase_10 AC 1,071 ms
90,388 KB
testcase_11 AC 770 ms
86,444 KB
testcase_12 AC 141 ms
78,332 KB
testcase_13 AC 1,054 ms
97,068 KB
testcase_14 AC 1,278 ms
102,076 KB
testcase_15 AC 1,045 ms
108,248 KB
testcase_16 AC 1,214 ms
86,732 KB
testcase_17 AC 632 ms
93,948 KB
testcase_18 AC 1,355 ms
93,288 KB
testcase_19 AC 408 ms
93,396 KB
testcase_20 AC 258 ms
84,264 KB
testcase_21 AC 676 ms
104,668 KB
testcase_22 AC 1,011 ms
106,300 KB
testcase_23 AC 1,728 ms
108,612 KB
testcase_24 AC 1,829 ms
108,232 KB
testcase_25 AC 2,126 ms
108,464 KB
testcase_26 AC 1,667 ms
107,780 KB
testcase_27 AC 2,111 ms
108,496 KB
testcase_28 AC 1,730 ms
107,856 KB
testcase_29 AC 2,034 ms
108,360 KB
testcase_30 AC 1,816 ms
108,748 KB
testcase_31 AC 1,704 ms
107,760 KB
testcase_32 AC 1,907 ms
107,736 KB
testcase_33 AC 104 ms
77,812 KB
testcase_34 AC 97 ms
76,972 KB
testcase_35 AC 111 ms
77,400 KB
testcase_36 AC 106 ms
77,068 KB
testcase_37 AC 101 ms
76,680 KB
testcase_38 AC 116 ms
77,644 KB
testcase_39 AC 109 ms
77,136 KB
testcase_40 AC 104 ms
77,068 KB
testcase_41 AC 115 ms
77,348 KB
testcase_42 AC 106 ms
77,272 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop as pop, heappush as push, heapify

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

def solve(k):
    hh = list(map(lambda x: -(x-k), H))
    heapify(hh)
    for _ in range(A):
        h = -pop(hh)
        h -= X
        push(hh, -h)
    remain = 0
    for h in hh:
        remain += max(0, -h)
    return remain <= Y*B

ok, ng = max(H), -1
while abs(ok-ng) > 1:
    mid = (ok+ng)//2
    if solve(mid):
        ok = mid
    else:
        ng = mid
print(ok)
0