結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー 👑 H20H20
提出日時 2021-11-12 22:24:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 692 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 82,200 KB
実行使用メモリ 108,008 KB
最終ジャッジ日時 2024-05-04 09:29:15
合計ジャッジ時間 7,876 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
52,736 KB
testcase_01 AC 35 ms
52,864 KB
testcase_02 AC 37 ms
52,736 KB
testcase_03 WA -
testcase_04 AC 240 ms
93,908 KB
testcase_05 AC 272 ms
92,404 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 113 ms
83,832 KB
testcase_09 AC 143 ms
89,032 KB
testcase_10 AC 151 ms
88,752 KB
testcase_11 WA -
testcase_12 AC 54 ms
71,700 KB
testcase_13 WA -
testcase_14 AC 201 ms
87,864 KB
testcase_15 AC 211 ms
90,892 KB
testcase_16 AC 174 ms
84,776 KB
testcase_17 AC 206 ms
86,816 KB
testcase_18 AC 197 ms
87,048 KB
testcase_19 AC 136 ms
85,940 KB
testcase_20 WA -
testcase_21 AC 167 ms
94,844 KB
testcase_22 AC 202 ms
89,160 KB
testcase_23 AC 233 ms
108,008 KB
testcase_24 AC 258 ms
92,196 KB
testcase_25 AC 258 ms
91,992 KB
testcase_26 WA -
testcase_27 AC 261 ms
107,072 KB
testcase_28 WA -
testcase_29 AC 251 ms
104,072 KB
testcase_30 AC 253 ms
95,732 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 41 ms
60,436 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 45 ms
60,672 KB
testcase_39 AC 45 ms
62,592 KB
testcase_40 AC 44 ms
60,416 KB
testcase_41 AC 43 ms
60,672 KB
testcase_42 AC 43 ms
60,288 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

def is_ok(K):
    HH = [0]*N
    for i in range(N):
        HH[i]=H[i]-K
    y = Y*B
    j = 0
    while y>0 and j<N:
        d = min(y,HH[j])
        if d>0:
            HH[j]-=d
            y-=d
        j+=1
    return max(HH)<=0

def meguru_bisect(ok, ng):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok


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

HQ = []
for i in range(N):
    heapq.heappush(HQ,(-H[i],i))
for _ in range(A):
    hi,i = heapq.heappop(HQ)
    H[i]-=X
    heapq.heappush(HQ,(-H[i],i))



print(meguru_bisect(10**9 + 1,0))
0