結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー 河野竜也
提出日時 2022-06-22 16:12:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,185 ms / 3,000 ms
コード長 445 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 108,152 KB
最終ジャッジ日時 2024-10-15 20:19:19
合計ジャッジ時間 38,705 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40
権限があれば一括ダウンロードができます

ソースコード

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