結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー dn6049949dn6049949
提出日時 2021-11-14 21:51:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,923 ms / 3,000 ms
コード長 1,028 bytes
コンパイル時間 981 ms
コンパイル使用メモリ 86,716 KB
実行使用メモリ 159,736 KB
最終ジャッジ日時 2023-08-20 06:37:58
合計ジャッジ時間 37,662 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,536 KB
testcase_01 AC 91 ms
71,468 KB
testcase_02 AC 90 ms
71,696 KB
testcase_03 AC 92 ms
71,448 KB
testcase_04 AC 1,360 ms
139,932 KB
testcase_05 AC 1,887 ms
152,564 KB
testcase_06 AC 632 ms
145,956 KB
testcase_07 AC 96 ms
71,492 KB
testcase_08 AC 298 ms
113,900 KB
testcase_09 AC 344 ms
124,608 KB
testcase_10 AC 902 ms
96,744 KB
testcase_11 AC 591 ms
96,628 KB
testcase_12 AC 117 ms
77,492 KB
testcase_13 AC 990 ms
126,684 KB
testcase_14 AC 1,179 ms
126,176 KB
testcase_15 AC 961 ms
143,832 KB
testcase_16 AC 1,123 ms
94,308 KB
testcase_17 AC 591 ms
108,348 KB
testcase_18 AC 1,136 ms
102,532 KB
testcase_19 AC 250 ms
87,024 KB
testcase_20 AC 249 ms
87,568 KB
testcase_21 AC 511 ms
115,744 KB
testcase_22 AC 961 ms
133,736 KB
testcase_23 AC 1,580 ms
159,736 KB
testcase_24 AC 1,772 ms
150,028 KB
testcase_25 AC 1,880 ms
138,736 KB
testcase_26 AC 1,536 ms
159,092 KB
testcase_27 AC 1,923 ms
145,560 KB
testcase_28 AC 1,606 ms
158,400 KB
testcase_29 AC 1,912 ms
146,884 KB
testcase_30 AC 1,642 ms
153,044 KB
testcase_31 AC 1,658 ms
159,608 KB
testcase_32 AC 1,862 ms
147,860 KB
testcase_33 AC 127 ms
77,840 KB
testcase_34 AC 94 ms
71,416 KB
testcase_35 AC 132 ms
77,804 KB
testcase_36 AC 131 ms
77,352 KB
testcase_37 AC 104 ms
76,588 KB
testcase_38 AC 131 ms
78,044 KB
testcase_39 AC 118 ms
77,136 KB
testcase_40 AC 120 ms
77,444 KB
testcase_41 AC 130 ms
77,660 KB
testcase_42 AC 123 ms
77,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def IR(n):
    return [I() for _ in range(n)]
def LIR(n):
    return [LI() for _ in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def main():
    def f(k):
        h = [i-k for i in h_]
        q = []
        for i in h:
            if i > 0:
                heappush(q,-i)
        for _ in range(a):
            if not q:
                break
            i = heappop(q)
            i += x
            if i < 0:
                heappush(q,i)
        s = -sum(q)
        return s <= b*y

    n,a,b,x,y = LI()
    h_ = LI()
    l = -1
    r = 10**9+1
    while l+1 < r:
        k = (l+r) >> 1
        if f(k):
            r = k
        else:
            l = k
    print(r)
    return


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