結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー horitaka1999horitaka1999
提出日時 2021-11-12 22:26:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,170 ms / 3,000 ms
コード長 632 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 163,396 KB
最終ジャッジ日時 2023-08-17 02:24:11
合計ジャッジ時間 38,275 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
71,428 KB
testcase_01 AC 78 ms
71,456 KB
testcase_02 AC 82 ms
71,280 KB
testcase_03 AC 80 ms
71,348 KB
testcase_04 AC 1,525 ms
144,088 KB
testcase_05 AC 2,026 ms
153,320 KB
testcase_06 AC 699 ms
149,916 KB
testcase_07 AC 80 ms
71,372 KB
testcase_08 AC 339 ms
114,692 KB
testcase_09 AC 404 ms
130,556 KB
testcase_10 AC 957 ms
99,136 KB
testcase_11 AC 631 ms
97,920 KB
testcase_12 AC 117 ms
77,616 KB
testcase_13 AC 1,056 ms
130,800 KB
testcase_14 AC 1,294 ms
126,804 KB
testcase_15 AC 1,089 ms
145,836 KB
testcase_16 AC 1,186 ms
95,004 KB
testcase_17 AC 655 ms
109,856 KB
testcase_18 AC 1,236 ms
105,856 KB
testcase_19 AC 288 ms
92,360 KB
testcase_20 AC 271 ms
89,716 KB
testcase_21 AC 588 ms
120,732 KB
testcase_22 AC 1,046 ms
136,796 KB
testcase_23 AC 1,720 ms
160,620 KB
testcase_24 AC 1,909 ms
153,412 KB
testcase_25 AC 2,019 ms
143,644 KB
testcase_26 AC 1,708 ms
163,272 KB
testcase_27 AC 2,170 ms
145,572 KB
testcase_28 AC 1,702 ms
163,396 KB
testcase_29 AC 2,070 ms
146,556 KB
testcase_30 AC 1,761 ms
158,268 KB
testcase_31 AC 1,770 ms
162,552 KB
testcase_32 AC 2,051 ms
150,084 KB
testcase_33 AC 114 ms
77,400 KB
testcase_34 AC 78 ms
71,532 KB
testcase_35 AC 119 ms
77,404 KB
testcase_36 AC 120 ms
77,608 KB
testcase_37 AC 88 ms
75,784 KB
testcase_38 AC 119 ms
77,368 KB
testcase_39 AC 112 ms
77,220 KB
testcase_40 AC 108 ms
77,320 KB
testcase_41 AC 116 ms
77,360 KB
testcase_42 AC 115 ms
77,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop,heappush
N,A,B,X,Y = map(int,input().split())
H = list(map(int,input().split()))
def is_ok(nH,nA):
    q = []
    for h in nH:
        if h > 0:
            heappush(q,-h)
    while nA and q:
        h = heappop(q)
        h *= -1
        if h > X:
            heappush(q,-(h-X))
        nA -=1
    SUMS = 0
    for h in q:
        SUMS += -h
    if SUMS <= Y * B:
        return True
    else:
        return False
ok = 10 ** 9
ng = -1
while ok - ng > 1:
    x = (ng+ok)//2
    nH = []
    for i in range(N):
        nH.append(H[i]-x)
    if is_ok(nH,A):
        ok = x
    else:
        ng = x
print(ok)
0