結果
| 問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-12 22:35:03 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 2,578 ms / 3,000 ms |
| コード長 | 603 bytes |
| コンパイル時間 | 349 ms |
| コンパイル使用メモリ | 82,048 KB |
| 実行使用メモリ | 127,032 KB |
| 最終ジャッジ日時 | 2024-11-25 20:02:10 |
| 合計ジャッジ時間 | 48,829 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
def main():
from heapq import heapify,heappush,heappop
n,A,b,x,y = map(int,input().split())
H = list(map(int,input().split()))
ng,ok = -1,1000000000
while ok-ng > 1:
mid = (ok+ng)>>1
a = A
h = list(map(lambda x: (x-mid)*-1,H))
heapify(h)
while a:
v = heappop(h)*-1
if v <= 0:
break
heappush(h,(v-x)*-1)
a -= 1
s = 0
while h:
s += max(0, heappop(h)*-1)
if s <= y*b:
ok = mid
else:
ng = mid
print(ok)
main()