結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー kohei2019kohei2019
提出日時 2023-06-12 00:12:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 675 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 126,924 KB
最終ジャッジ日時 2023-09-01 03:55:46
合計ジャッジ時間 15,069 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,236 KB
testcase_01 AC 73 ms
71,392 KB
testcase_02 AC 74 ms
71,388 KB
testcase_03 WA -
testcase_04 AC 2,902 ms
126,804 KB
testcase_05 TLE -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 472 ms
105,828 KB
testcase_09 AC 667 ms
118,976 KB
testcase_10 AC 1,976 ms
96,920 KB
testcase_11 WA -
testcase_12 AC 169 ms
78,268 KB
testcase_13 WA -
testcase_14 AC 2,372 ms
113,940 KB
testcase_15 AC 1,854 ms
126,688 KB
testcase_16 AC 2,204 ms
91,696 KB
testcase_17 AC 1,060 ms
102,156 KB
testcase_18 AC 2,508 ms
101,632 KB
testcase_19 AC 583 ms
101,992 KB
testcase_20 WA -
testcase_21 AC 1,101 ms
117,708 KB
testcase_22 AC 1,869 ms
121,628 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 118 ms
77,596 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 122 ms
77,860 KB
testcase_39 AC 124 ms
77,720 KB
testcase_40 AC 114 ms
77,312 KB
testcase_41 AC 124 ms
77,716 KB
testcase_42 AC 114 ms
77,600 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(0,10**18+1))


0