結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー MasKoaTSMasKoaTS
提出日時 2021-11-12 22:04:26
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,019 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 181,592 KB
最終ジャッジ日時 2024-05-04 08:53:05
合計ジャッジ時間 66,415 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
86,272 KB
testcase_01 AC 137 ms
86,400 KB
testcase_02 AC 146 ms
86,016 KB
testcase_03 AC 168 ms
94,724 KB
testcase_04 AC 2,925 ms
175,232 KB
testcase_05 TLE -
testcase_06 AC 1,561 ms
155,776 KB
testcase_07 AC 170 ms
95,744 KB
testcase_08 AC 998 ms
118,144 KB
testcase_09 AC 1,511 ms
143,104 KB
testcase_10 AC 1,634 ms
122,496 KB
testcase_11 AC 1,178 ms
116,096 KB
testcase_12 AC 312 ms
90,240 KB
testcase_13 AC 1,867 ms
136,448 KB
testcase_14 AC 2,187 ms
150,144 KB
testcase_15 AC 2,358 ms
166,656 KB
testcase_16 AC 1,578 ms
123,264 KB
testcase_17 AC 1,235 ms
122,112 KB
testcase_18 AC 2,059 ms
132,864 KB
testcase_19 AC 993 ms
114,920 KB
testcase_20 AC 541 ms
97,280 KB
testcase_21 AC 1,706 ms
150,144 KB
testcase_22 AC 2,179 ms
156,032 KB
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 2,963 ms
174,960 KB
testcase_27 TLE -
testcase_28 AC 2,903 ms
176,168 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 2,998 ms
174,040 KB
testcase_32 TLE -
testcase_33 AC 187 ms
89,716 KB
testcase_34 AC 171 ms
89,472 KB
testcase_35 AC 197 ms
89,600 KB
testcase_36 AC 190 ms
89,216 KB
testcase_37 AC 174 ms
89,652 KB
testcase_38 AC 203 ms
89,856 KB
testcase_39 AC 208 ms
90,240 KB
testcase_40 AC 186 ms
89,472 KB
testcase_41 AC 195 ms
89,480 KB
testcase_42 AC 196 ms
89,728 KB
権限があれば一括ダウンロードができます

ソースコード

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**9
ng = -1
while(ok-ng > 1):
	k = (ok+ng)//2
	if(func(k)):
		ok = k
	else:
		ng = k
print(ok)
0