結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-11-12 21:55:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,931 ms / 3,000 ms
コード長 567 bytes
コンパイル時間 299 ms
コンパイル使用メモリ 86,852 KB
実行使用メモリ 138,412 KB
最終ジャッジ日時 2023-08-17 01:12:43
合計ジャッジ時間 35,270 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,492 KB
testcase_01 AC 74 ms
71,444 KB
testcase_02 AC 75 ms
71,396 KB
testcase_03 AC 86 ms
75,976 KB
testcase_04 AC 1,396 ms
116,468 KB
testcase_05 AC 1,826 ms
125,508 KB
testcase_06 AC 658 ms
124,180 KB
testcase_07 AC 86 ms
75,896 KB
testcase_08 AC 264 ms
97,612 KB
testcase_09 AC 312 ms
104,140 KB
testcase_10 AC 906 ms
87,556 KB
testcase_11 AC 588 ms
89,628 KB
testcase_12 AC 94 ms
76,496 KB
testcase_13 AC 981 ms
111,864 KB
testcase_14 AC 1,153 ms
108,640 KB
testcase_15 AC 927 ms
118,496 KB
testcase_16 AC 1,104 ms
87,124 KB
testcase_17 AC 589 ms
97,556 KB
testcase_18 AC 1,114 ms
90,168 KB
testcase_19 AC 223 ms
83,260 KB
testcase_20 AC 216 ms
83,504 KB
testcase_21 AC 476 ms
95,220 KB
testcase_22 AC 912 ms
113,588 KB
testcase_23 AC 1,484 ms
133,800 KB
testcase_24 AC 1,682 ms
124,464 KB
testcase_25 AC 1,810 ms
114,316 KB
testcase_26 AC 1,597 ms
138,412 KB
testcase_27 AC 1,931 ms
118,604 KB
testcase_28 AC 1,615 ms
137,032 KB
testcase_29 AC 1,869 ms
118,736 KB
testcase_30 AC 1,602 ms
127,720 KB
testcase_31 AC 1,633 ms
136,428 KB
testcase_32 AC 1,900 ms
126,992 KB
testcase_33 AC 105 ms
77,636 KB
testcase_34 AC 77 ms
75,360 KB
testcase_35 AC 111 ms
77,532 KB
testcase_36 AC 108 ms
77,412 KB
testcase_37 AC 90 ms
76,260 KB
testcase_38 AC 114 ms
77,716 KB
testcase_39 AC 104 ms
76,984 KB
testcase_40 AC 96 ms
76,412 KB
testcase_41 AC 126 ms
77,196 KB
testcase_42 AC 116 ms
77,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop,heappush
n,a,b,x,y = map(int,input().split())
H = list(map(int,input().split()))

def calc(k):
    h = []
    for i in H:
        if i <= k:
            continue
        heappush(h,-i+k)

    for i in range(a):
        if h:
            num = -heappop(h)
            num -= x
            if num <= 0:
                continue
            heappush(h,-num)

    count = -sum(h)
    if count <= b*y:
        return 1
    return 0


l = -1
r = 10**10
while r > l+1:
    m = (r+l)//2
    if calc(m):
        r = m
    else:
        l = m
print(r)
0