結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー 河野竜也
提出日時 2022-06-22 16:11:54
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 445 bytes
コンパイル時間 233 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 28,856 KB
最終ジャッジ日時 2024-10-15 20:17:48
合計ジャッジ時間 7,039 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 2 -- * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
n,a,b,x,y=map(int,input().split())
h=list(map(int,input().split()))
def check(k):
  c=[]
  for i in range(n):
    c.append(min(0,k-h[i]))
  heapq.heapify(c)

  for i in range(a):
    target=heapq.heappop(c)
    target=min(0,x+target)
    heapq.heappush(c,target)

  if (-1)*sum(c)<=b*y:
    return True
  else:
    return False

ub=10**9
lb=-1
while ub-lb>1:
  mid=(ub+lb)//2
  if check(mid):
    ub=mid
  else:
    lb=mid
print(ub)
0