結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー titiatitia
提出日時 2021-11-12 22:05:26
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,704 ms / 3,000 ms
コード長 450 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,044 KB
実行使用メモリ 108,440 KB
最終ジャッジ日時 2024-05-04 08:54:15
合計ジャッジ時間 31,222 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,200 KB
testcase_01 AC 37 ms
52,984 KB
testcase_02 AC 35 ms
52,896 KB
testcase_03 AC 48 ms
63,448 KB
testcase_04 AC 1,344 ms
108,104 KB
testcase_05 AC 1,698 ms
107,748 KB
testcase_06 AC 974 ms
107,056 KB
testcase_07 AC 49 ms
64,564 KB
testcase_08 AC 232 ms
94,196 KB
testcase_09 AC 339 ms
103,692 KB
testcase_10 AC 878 ms
89,384 KB
testcase_11 AC 570 ms
85,288 KB
testcase_12 AC 87 ms
77,120 KB
testcase_13 AC 874 ms
96,448 KB
testcase_14 AC 1,072 ms
100,300 KB
testcase_15 AC 893 ms
107,820 KB
testcase_16 AC 1,040 ms
85,384 KB
testcase_17 AC 572 ms
92,732 KB
testcase_18 AC 1,092 ms
91,672 KB
testcase_19 AC 314 ms
92,716 KB
testcase_20 AC 214 ms
83,916 KB
testcase_21 AC 568 ms
103,228 KB
testcase_22 AC 899 ms
104,460 KB
testcase_23 AC 1,419 ms
107,980 KB
testcase_24 AC 1,522 ms
108,088 KB
testcase_25 AC 1,704 ms
107,724 KB
testcase_26 AC 1,364 ms
106,820 KB
testcase_27 AC 1,676 ms
107,416 KB
testcase_28 AC 1,395 ms
106,580 KB
testcase_29 AC 1,631 ms
108,440 KB
testcase_30 AC 1,546 ms
107,488 KB
testcase_31 AC 1,373 ms
106,440 KB
testcase_32 AC 1,537 ms
107,272 KB
testcase_33 AC 63 ms
72,532 KB
testcase_34 AC 53 ms
75,804 KB
testcase_35 AC 84 ms
76,196 KB
testcase_36 AC 75 ms
76,012 KB
testcase_37 AC 62 ms
75,668 KB
testcase_38 AC 78 ms
76,832 KB
testcase_39 AC 70 ms
76,436 KB
testcase_40 AC 62 ms
74,220 KB
testcase_41 AC 77 ms
76,656 KB
testcase_42 AC 70 ms
76,092 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