結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー brthyyjpbrthyyjp
提出日時 2021-11-14 02:00:25
言語 PyPy3
(7.3.15)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 633 bytes
コンパイル時間 793 ms
コンパイル使用メモリ 87,128 KB
実行使用メモリ 127,060 KB
最終ジャッジ日時 2023-08-19 02:43:33
合計ジャッジ時間 42,105 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 62 ms
71,100 KB
testcase_01 AC 62 ms
71,056 KB
testcase_02 AC 63 ms
71,124 KB
testcase_03 AC 64 ms
75,228 KB
testcase_04 AC 1,534 ms
114,688 KB
testcase_05 AC 2,450 ms
127,060 KB
testcase_06 AC 586 ms
119,564 KB
testcase_07 AC 67 ms
75,100 KB
testcase_08 AC 733 ms
100,672 KB
testcase_09 AC 858 ms
103,932 KB
testcase_10 AC 787 ms
87,196 KB
testcase_11 AC 505 ms
88,232 KB
testcase_12 AC 115 ms
78,404 KB
testcase_13 AC 946 ms
107,200 KB
testcase_14 AC 1,609 ms
110,400 KB
testcase_15 AC 1,327 ms
118,848 KB
testcase_16 AC 1,121 ms
87,796 KB
testcase_17 AC 752 ms
98,844 KB
testcase_18 AC 1,239 ms
91,320 KB
testcase_19 AC 265 ms
83,980 KB
testcase_20 AC 391 ms
86,400 KB
testcase_21 AC 674 ms
96,736 KB
testcase_22 AC 1,333 ms
114,372 KB
testcase_23 AC 1,449 ms
121,748 KB
testcase_24 AC 2,337 ms
125,848 KB
testcase_25 AC 2,282 ms
116,276 KB
testcase_26 AC 1,561 ms
126,120 KB
testcase_27 AC 2,432 ms
120,212 KB
testcase_28 AC 1,573 ms
125,376 KB
testcase_29 AC 2,332 ms
122,632 KB
testcase_30 AC 1,680 ms
120,100 KB
testcase_31 AC 1,672 ms
124,492 KB
testcase_32 AC 2,306 ms
124,764 KB
testcase_33 AC 95 ms
77,584 KB
testcase_34 AC 65 ms
75,320 KB
testcase_35 AC 92 ms
77,548 KB
testcase_36 AC 88 ms
77,392 KB
testcase_37 RE -
testcase_38 AC 110 ms
77,936 KB
testcase_39 AC 99 ms
77,608 KB
testcase_40 AC 95 ms
77,916 KB
testcase_41 AC 108 ms
77,752 KB
testcase_42 AC 93 ms
77,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def is_ok(k):
    q = []
    for h in H:
        if h > k:
            q.append(-(h-k))
    heapq.heapify(q)
    for i in range(a):
        if q:
            v = heapq.heappop(q)
            v = -v
            if v > x:
                v -= x
                heapq.heappush(q, -v)
    if not q:
        return True
    s = 0
    while  q:
        v = heapq.heappop(q)
        v = -v
        s += v
    return  s <= y*b

ng = -1
ok = max(H)
while ng+1<ok:
    c = (ng+ok)//2
    if is_ok(c):
        ok = c
    else:
        ng = c
print(ok)
0