結果
| 問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
| コンテスト | |
| ユーザー |
puzneko
|
| 提出日時 | 2021-11-24 23:45:47 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 605 bytes |
| コンパイル時間 | 633 ms |
| コンパイル使用メモリ | 82,408 KB |
| 実行使用メモリ | 140,260 KB |
| 最終ジャッジ日時 | 2024-06-27 09:22:58 |
| 合計ジャッジ時間 | 49,052 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 38 TLE * 2 |
ソースコード
from sys import stdin
from heapq import heappush, heappop
n, a, b, x, y, *h = map(int, stdin.read().split())
left = -1
right = 10**9+1
while right - left >= 2:
mid = (right + left) // 2
hq = []
for i in range(n):
if h[i] - mid > 0:
heappush(hq, -(h[i]-mid))
for i in range(a):
if hq:
now = -heappop(hq)
if now > x:
kari = now - x
heappush(hq, -kari)
kari = 0
while hq:
kari += -heappop(hq)
if kari <= b * y:
right = mid
else:
left = mid
print("{}".format(right))
puzneko