結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー SidewaysOwlSidewaysOwl
提出日時 2021-11-12 22:22:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,189 ms / 3,000 ms
コード長 649 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,116 KB
実行使用メモリ 141,288 KB
最終ジャッジ日時 2023-08-17 02:12:34
合計ジャッジ時間 41,289 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,444 KB
testcase_01 AC 73 ms
71,376 KB
testcase_02 AC 73 ms
71,440 KB
testcase_03 AC 90 ms
76,336 KB
testcase_04 AC 1,701 ms
140,952 KB
testcase_05 AC 2,080 ms
140,708 KB
testcase_06 AC 1,199 ms
137,980 KB
testcase_07 AC 86 ms
76,092 KB
testcase_08 AC 371 ms
112,036 KB
testcase_09 AC 523 ms
130,892 KB
testcase_10 AC 1,096 ms
101,400 KB
testcase_11 AC 718 ms
94,236 KB
testcase_12 AC 144 ms
78,728 KB
testcase_13 AC 1,071 ms
116,260 KB
testcase_14 AC 1,370 ms
126,184 KB
testcase_15 AC 1,158 ms
138,920 KB
testcase_16 AC 1,231 ms
97,324 KB
testcase_17 AC 701 ms
109,132 KB
testcase_18 AC 1,450 ms
108,304 KB
testcase_19 AC 430 ms
108,164 KB
testcase_20 AC 291 ms
90,532 KB
testcase_21 AC 785 ms
130,480 KB
testcase_22 AC 1,148 ms
133,240 KB
testcase_23 AC 1,856 ms
140,704 KB
testcase_24 AC 1,953 ms
141,288 KB
testcase_25 AC 2,189 ms
140,084 KB
testcase_26 AC 1,757 ms
137,660 KB
testcase_27 AC 2,161 ms
140,144 KB
testcase_28 AC 1,776 ms
137,668 KB
testcase_29 AC 2,125 ms
139,992 KB
testcase_30 AC 1,941 ms
140,368 KB
testcase_31 AC 1,789 ms
139,312 KB
testcase_32 AC 2,036 ms
139,452 KB
testcase_33 AC 106 ms
77,348 KB
testcase_34 AC 90 ms
77,232 KB
testcase_35 AC 122 ms
77,476 KB
testcase_36 AC 115 ms
77,368 KB
testcase_37 AC 99 ms
77,104 KB
testcase_38 AC 118 ms
77,776 KB
testcase_39 AC 120 ms
77,892 KB
testcase_40 AC 109 ms
77,456 KB
testcase_41 AC 123 ms
77,768 KB
testcase_42 AC 113 ms
77,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,a,b,x,y = map(int,input().split())
H = list(map(lambda x:-int(x),input().split()))


import heapq

# print(q)
def isok(mid):
    h = list(map(lambda x:min(0,x+mid),H))
    heapq.heapify(h)
    b_sum = b*y
#     print(h,mid)
    for i in range(a):
        aa = heapq.heappop(h)
        aa = min(aa+x,0)
        heapq.heappush(h,aa)
    h = list(map(lambda x:-int(x),h))
    # print(h)
    for i in range(n):
        d = min(b_sum,h[i])
        h[i] -= d
        b_sum -= d
    if sum(h) == 0:return True
    else:return False
l = -1
r = -min(H)
while r-l > 1:
    mid = (r+l) //2
    if isok(mid):
        r = mid
    else:
        l = mid
print(r)
0