結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー gr1msl3ygr1msl3y
提出日時 2021-11-12 22:22:41
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 1,806 ms / 3,000 ms
コード長 520 bytes
コンパイル時間 430 ms
コンパイル使用メモリ 87,296 KB
実行使用メモリ 105,008 KB
最終ジャッジ日時 2023-08-17 02:14:28
合計ジャッジ時間 35,501 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,344 KB
testcase_01 AC 75 ms
71,388 KB
testcase_02 AC 78 ms
71,216 KB
testcase_03 AC 94 ms
76,184 KB
testcase_04 AC 1,418 ms
103,596 KB
testcase_05 AC 1,803 ms
105,008 KB
testcase_06 AC 916 ms
102,212 KB
testcase_07 AC 90 ms
76,156 KB
testcase_08 AC 350 ms
93,696 KB
testcase_09 AC 449 ms
104,124 KB
testcase_10 AC 1,019 ms
87,864 KB
testcase_11 AC 769 ms
85,224 KB
testcase_12 AC 89 ms
76,256 KB
testcase_13 AC 944 ms
94,212 KB
testcase_14 AC 1,210 ms
97,164 KB
testcase_15 AC 1,016 ms
103,932 KB
testcase_16 AC 1,165 ms
86,024 KB
testcase_17 AC 632 ms
91,748 KB
testcase_18 AC 1,224 ms
90,444 KB
testcase_19 AC 282 ms
83,336 KB
testcase_20 AC 271 ms
80,948 KB
testcase_21 AC 588 ms
95,828 KB
testcase_22 AC 1,001 ms
101,152 KB
testcase_23 AC 1,525 ms
104,132 KB
testcase_24 AC 1,710 ms
103,592 KB
testcase_25 AC 1,806 ms
103,856 KB
testcase_26 AC 1,487 ms
103,484 KB
testcase_27 AC 1,794 ms
103,760 KB
testcase_28 AC 1,518 ms
102,920 KB
testcase_29 AC 1,777 ms
103,656 KB
testcase_30 AC 1,600 ms
103,852 KB
testcase_31 AC 1,531 ms
103,024 KB
testcase_32 AC 1,709 ms
102,908 KB
testcase_33 AC 97 ms
76,776 KB
testcase_34 AC 91 ms
77,072 KB
testcase_35 AC 106 ms
77,348 KB
testcase_36 AC 112 ms
77,272 KB
testcase_37 AC 102 ms
77,180 KB
testcase_38 AC 105 ms
77,440 KB
testcase_39 AC 92 ms
76,036 KB
testcase_40 AC 89 ms
75,840 KB
testcase_41 AC 102 ms
76,868 KB
testcase_42 AC 100 ms
76,668 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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


def solve(k):
    task = [min(k-h, 0) for h in H]
    task.sort()
    S = -sum(task)
    for _ in range(A):
        v = -hq.heappop(task)
        if v >= X:
            S -= X
            v -= X
        else:
            S -= v
            v = 0
        hq.heappush(task, -v)
    return S <= B*Y


ng, ok = -1, 10**9
while ok-ng > 1:
    m = (ng+ok)//2
    if solve(m):
        ok = m
    else:
        ng = m

print(ok)
0