結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー MasKoaTS
提出日時 2021-11-12 22:02:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,019 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 82,232 KB
実行使用メモリ 143,488 KB
最終ジャッジ日時 2024-11-25 18:32:57
合計ジャッジ時間 43,321 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 14 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools as iter
import collections as coll
import heapq as hq
import bisect as bis
from decimal import Decimal as dec
from copy import deepcopy as dcopy
import math
import sys
sys.setrecursionlimit(10**6)
def input():
    return sys.stdin.readline().rstrip()
def getN():
	return int(sys.stdin.readline())
def getNs():
	return map(int,sys.stdin.readline().split())
def getList():
	return list(map(int,sys.stdin.readline().split()))
def strinps(n):
	return [sys.stdin.readline().rstrip() for _ in range(n)]
pi = 3.141592653589793
mod = 10**9+7
MOD = 998244353
INF = math.inf
dx = [1,0,-1,0];	dy = [0,1,0,-1]

def func(k):
	hque = []
	for i in h:
		hq.heappush(hque,-i+k)
	for _ in [0]*a:
		hp = hq.heappop(hque)
		hq.heappush(hque,hp+x)
	s = 0
	while(hque):
		hp = -hq.heappop(hque)
		#print(hp)
		s += max(0,hp)
	if(s <= y*b):
		return True
	return False

"""
Main Code
"""

n,a,b,x,y = getNs()
h = getList()

ok = 10**5
ng = -1
while(ok-ng > 1):
	k = (ok+ng)//2
	if(func(k)):
		ok = k
	else:
		ng = k
print(ok)
0