結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー gr1msl3ygr1msl3y
提出日時 2021-11-12 22:22:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,596 ms / 3,000 ms
コード長 520 bytes
コンパイル時間 271 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 103,044 KB
最終ジャッジ日時 2024-05-04 09:27:01
合計ジャッジ時間 32,448 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,244 KB
testcase_01 AC 37 ms
53,812 KB
testcase_02 AC 36 ms
53,120 KB
testcase_03 AC 51 ms
62,628 KB
testcase_04 AC 1,257 ms
103,044 KB
testcase_05 AC 1,573 ms
102,164 KB
testcase_06 AC 781 ms
100,956 KB
testcase_07 AC 50 ms
63,216 KB
testcase_08 AC 312 ms
93,024 KB
testcase_09 AC 409 ms
97,736 KB
testcase_10 AC 856 ms
86,396 KB
testcase_11 AC 650 ms
83,612 KB
testcase_12 AC 50 ms
66,728 KB
testcase_13 AC 833 ms
92,576 KB
testcase_14 AC 1,055 ms
95,624 KB
testcase_15 AC 927 ms
103,016 KB
testcase_16 AC 966 ms
83,508 KB
testcase_17 AC 555 ms
89,432 KB
testcase_18 AC 1,066 ms
89,284 KB
testcase_19 AC 233 ms
82,116 KB
testcase_20 AC 225 ms
79,088 KB
testcase_21 AC 522 ms
93,188 KB
testcase_22 AC 909 ms
100,068 KB
testcase_23 AC 1,354 ms
102,600 KB
testcase_24 AC 1,490 ms
102,116 KB
testcase_25 AC 1,561 ms
102,540 KB
testcase_26 AC 1,308 ms
100,936 KB
testcase_27 AC 1,572 ms
102,128 KB
testcase_28 AC 1,344 ms
100,932 KB
testcase_29 AC 1,596 ms
102,012 KB
testcase_30 AC 1,424 ms
102,516 KB
testcase_31 AC 1,355 ms
101,428 KB
testcase_32 AC 1,532 ms
102,124 KB
testcase_33 AC 63 ms
67,976 KB
testcase_34 AC 62 ms
75,636 KB
testcase_35 AC 77 ms
76,136 KB
testcase_36 AC 79 ms
75,672 KB
testcase_37 AC 69 ms
75,852 KB
testcase_38 AC 68 ms
70,892 KB
testcase_39 AC 61 ms
65,128 KB
testcase_40 AC 53 ms
63,660 KB
testcase_41 AC 70 ms
69,704 KB
testcase_42 AC 58 ms
67,884 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