結果
| 問題 | No.1739 Princess vs. Dragoness (& AoE) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-11-12 22:31:03 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 2,377 ms / 3,000 ms |
| コード長 | 527 bytes |
| 記録 | |
| コンパイル時間 | 437 ms |
| コンパイル使用メモリ | 85,760 KB |
| 実行使用メモリ | 130,804 KB |
| 最終ジャッジ日時 | 2026-05-20 09:46:13 |
| 合計ジャッジ時間 | 45,864 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
from heapq import heapify,heappush,heappop
n,A,b,x,y = map(int,input().split())
H = list(map(int,input().split()))
def solve(k):
a = A
h = list(map(lambda x: (x-k)*-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)
return s <= y*b
ng,ok = -1,1234567890
while ok-ng > 1:
mid = (ok+ng)//2
if solve(mid):
ok = mid
else:
ng = mid
print(ok)