結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー brthyyjpbrthyyjp
提出日時 2021-11-14 02:08:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,565 ms / 3,000 ms
コード長 708 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 119,240 KB
最終ジャッジ日時 2023-08-19 02:57:25
合計ジャッジ時間 50,653 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
71,408 KB
testcase_01 AC 64 ms
71,176 KB
testcase_02 AC 66 ms
71,556 KB
testcase_03 AC 75 ms
76,052 KB
testcase_04 AC 2,084 ms
119,144 KB
testcase_05 AC 2,565 ms
119,240 KB
testcase_06 AC 1,225 ms
114,400 KB
testcase_07 AC 78 ms
76,172 KB
testcase_08 AC 729 ms
97,716 KB
testcase_09 AC 988 ms
109,836 KB
testcase_10 AC 1,173 ms
90,516 KB
testcase_11 AC 920 ms
86,572 KB
testcase_12 AC 170 ms
78,716 KB
testcase_13 AC 1,450 ms
99,996 KB
testcase_14 AC 1,665 ms
106,068 KB
testcase_15 AC 1,780 ms
116,668 KB
testcase_16 AC 1,291 ms
86,084 KB
testcase_17 AC 970 ms
95,036 KB
testcase_18 AC 1,466 ms
92,816 KB
testcase_19 AC 637 ms
95,172 KB
testcase_20 AC 392 ms
84,308 KB
testcase_21 AC 1,220 ms
111,108 KB
testcase_22 AC 1,614 ms
113,684 KB
testcase_23 AC 2,357 ms
118,708 KB
testcase_24 AC 2,401 ms
118,520 KB
testcase_25 AC 2,501 ms
117,956 KB
testcase_26 AC 2,308 ms
116,832 KB
testcase_27 AC 2,449 ms
118,788 KB
testcase_28 AC 2,316 ms
117,036 KB
testcase_29 AC 2,544 ms
118,712 KB
testcase_30 AC 2,455 ms
119,040 KB
testcase_31 AC 2,412 ms
117,408 KB
testcase_32 AC 2,547 ms
117,708 KB
testcase_33 AC 103 ms
77,624 KB
testcase_34 AC 89 ms
77,132 KB
testcase_35 AC 109 ms
77,580 KB
testcase_36 AC 104 ms
77,292 KB
testcase_37 AC 100 ms
77,288 KB
testcase_38 AC 120 ms
78,016 KB
testcase_39 AC 113 ms
77,992 KB
testcase_40 AC 102 ms
77,492 KB
testcase_41 AC 122 ms
77,932 KB
testcase_42 AC 111 ms
78,200 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():

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

    def is_ok(k):
        q = [0]*n
        for i, h in enumerate(H):
            q[i] = min(0, k-h)
        heapq.heapify(q)
        for i in range(a):
            v = heapq.heappop(q)
            v = -v
            v -= x
            heapq.heappush(q, -v)
        s = 0
        while  q:
            v = heapq.heappop(q)
            v = -v
            s += max(v, 0)
        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)

if __name__ == '__main__':
    main()
0