結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー titiatitia
提出日時 2021-11-12 22:05:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,403 ms / 3,000 ms
コード長 450 bytes
コンパイル時間 360 ms
コンパイル使用メモリ 87,100 KB
実行使用メモリ 110,672 KB
最終ジャッジ日時 2023-08-17 01:41:10
合計ジャッジ時間 43,543 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 91 ms
71,448 KB
testcase_01 AC 84 ms
71,428 KB
testcase_02 AC 85 ms
71,452 KB
testcase_03 AC 105 ms
76,496 KB
testcase_04 AC 1,816 ms
110,188 KB
testcase_05 AC 2,213 ms
109,448 KB
testcase_06 AC 1,224 ms
107,836 KB
testcase_07 AC 102 ms
76,480 KB
testcase_08 AC 341 ms
95,164 KB
testcase_09 AC 471 ms
104,720 KB
testcase_10 AC 1,121 ms
91,164 KB
testcase_11 AC 728 ms
87,492 KB
testcase_12 AC 149 ms
77,952 KB
testcase_13 AC 1,143 ms
98,264 KB
testcase_14 AC 1,425 ms
102,120 KB
testcase_15 AC 1,172 ms
110,156 KB
testcase_16 AC 1,311 ms
87,652 KB
testcase_17 AC 721 ms
95,292 KB
testcase_18 AC 1,467 ms
93,724 KB
testcase_19 AC 427 ms
93,944 KB
testcase_20 AC 302 ms
84,268 KB
testcase_21 AC 745 ms
105,060 KB
testcase_22 AC 1,186 ms
105,660 KB
testcase_23 AC 1,885 ms
110,100 KB
testcase_24 AC 2,001 ms
110,672 KB
testcase_25 AC 2,326 ms
110,020 KB
testcase_26 AC 1,896 ms
109,276 KB
testcase_27 AC 2,403 ms
109,804 KB
testcase_28 AC 1,866 ms
109,316 KB
testcase_29 AC 2,248 ms
110,144 KB
testcase_30 AC 1,963 ms
110,124 KB
testcase_31 AC 1,824 ms
108,672 KB
testcase_32 AC 2,060 ms
109,452 KB
testcase_33 AC 110 ms
78,164 KB
testcase_34 AC 97 ms
77,168 KB
testcase_35 AC 129 ms
77,684 KB
testcase_36 AC 124 ms
77,724 KB
testcase_37 AC 107 ms
77,012 KB
testcase_38 AC 128 ms
77,668 KB
testcase_39 AC 108 ms
77,100 KB
testcase_40 AC 101 ms
77,420 KB
testcase_41 AC 118 ms
77,564 KB
testcase_42 AC 106 ms
77,532 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
import heapq

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

OK=max(H)
NG=-1

while OK>NG+1:
    mid=(OK+NG)//2
    Q=[]
    for h in H:
        h-=mid
        Q.append(min(0,-h))

    heapq.heapify(Q)

    for i in range(A):
        x=-heapq.heappop(Q)
        x=max(0,x-X)
        heapq.heappush(Q,-x)
    

    S=-sum(Q)
    if S<=Y*B:
        OK=mid
    else:
        NG=mid

print(OK)
0