結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー kohei2019kohei2019
提出日時 2023-06-12 00:19:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,059 ms / 3,000 ms
コード長 673 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 104,096 KB
最終ジャッジ日時 2023-09-01 03:58:32
合計ジャッジ時間 38,500 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,664 KB
testcase_01 AC 75 ms
71,596 KB
testcase_02 AC 78 ms
71,588 KB
testcase_03 AC 86 ms
76,352 KB
testcase_04 AC 1,546 ms
103,404 KB
testcase_05 AC 1,935 ms
103,464 KB
testcase_06 AC 1,088 ms
102,684 KB
testcase_07 AC 84 ms
76,252 KB
testcase_08 AC 305 ms
92,480 KB
testcase_09 AC 409 ms
98,756 KB
testcase_10 AC 1,060 ms
87,872 KB
testcase_11 AC 795 ms
85,484 KB
testcase_12 AC 137 ms
77,724 KB
testcase_13 AC 1,058 ms
94,004 KB
testcase_14 AC 1,266 ms
96,848 KB
testcase_15 AC 1,016 ms
103,444 KB
testcase_16 AC 1,182 ms
85,356 KB
testcase_17 AC 599 ms
90,836 KB
testcase_18 AC 1,328 ms
90,612 KB
testcase_19 AC 368 ms
90,548 KB
testcase_20 AC 244 ms
82,624 KB
testcase_21 AC 632 ms
98,960 KB
testcase_22 AC 1,016 ms
100,912 KB
testcase_23 AC 1,698 ms
103,088 KB
testcase_24 AC 1,847 ms
103,916 KB
testcase_25 AC 2,059 ms
104,096 KB
testcase_26 AC 1,682 ms
103,328 KB
testcase_27 AC 2,009 ms
103,072 KB
testcase_28 AC 1,706 ms
102,568 KB
testcase_29 AC 2,004 ms
103,264 KB
testcase_30 AC 1,786 ms
103,292 KB
testcase_31 AC 1,698 ms
102,580 KB
testcase_32 AC 1,923 ms
102,576 KB
testcase_33 AC 108 ms
77,244 KB
testcase_34 AC 96 ms
77,352 KB
testcase_35 AC 112 ms
77,676 KB
testcase_36 AC 108 ms
77,340 KB
testcase_37 AC 105 ms
77,132 KB
testcase_38 AC 120 ms
77,404 KB
testcase_39 AC 111 ms
77,164 KB
testcase_40 AC 105 ms
77,088 KB
testcase_41 AC 119 ms
77,700 KB
testcase_42 AC 109 ms
77,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

def is_ok(arg):
    lsH = [-(lsH0[i]-arg) for i in range(N)]
    heapq.heapify(lsH)
    for i in range(A):
        hp = heapq.heappop(lsH)
        v = hp + X
        heapq.heappush(lsH, v)

    vsum = 0
    for j in lsH:
        if j >= 0:
            continue
        else:
            vsum -= j

    if vsum > B*Y:
        return False
    else:
        return True
 
 
def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok
print(meguru_bisect(-1,10**9+1))
0