結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー MasKoaTSMasKoaTS
提出日時 2021-11-12 22:04:26
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,019 bytes
コンパイル時間 310 ms
コンパイル使用メモリ 87,336 KB
実行使用メモリ 176,940 KB
最終ジャッジ日時 2023-08-17 01:39:48
合計ジャッジ時間 66,022 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 222 ms
83,372 KB
testcase_01 AC 218 ms
83,232 KB
testcase_02 AC 218 ms
83,396 KB
testcase_03 AC 232 ms
90,356 KB
testcase_04 AC 2,723 ms
168,560 KB
testcase_05 TLE -
testcase_06 AC 1,495 ms
151,504 KB
testcase_07 AC 240 ms
91,708 KB
testcase_08 AC 1,012 ms
114,400 KB
testcase_09 AC 1,495 ms
143,044 KB
testcase_10 AC 1,634 ms
120,184 KB
testcase_11 AC 1,213 ms
110,884 KB
testcase_12 AC 382 ms
86,216 KB
testcase_13 AC 1,766 ms
132,932 KB
testcase_14 AC 2,138 ms
147,408 KB
testcase_15 AC 2,334 ms
160,808 KB
testcase_16 AC 1,600 ms
117,196 KB
testcase_17 AC 1,259 ms
116,332 KB
testcase_18 AC 1,975 ms
127,956 KB
testcase_19 AC 1,034 ms
110,712 KB
testcase_20 AC 594 ms
92,620 KB
testcase_21 AC 1,697 ms
144,080 KB
testcase_22 AC 2,119 ms
152,616 KB
testcase_23 AC 2,913 ms
173,368 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 2,874 ms
170,900 KB
testcase_27 TLE -
testcase_28 AC 2,828 ms
172,260 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 AC 2,906 ms
173,996 KB
testcase_32 TLE -
testcase_33 AC 265 ms
85,328 KB
testcase_34 AC 239 ms
84,484 KB
testcase_35 AC 271 ms
85,648 KB
testcase_36 AC 260 ms
85,052 KB
testcase_37 AC 253 ms
85,412 KB
testcase_38 AC 272 ms
84,700 KB
testcase_39 AC 284 ms
85,700 KB
testcase_40 AC 255 ms
85,216 KB
testcase_41 AC 273 ms
85,544 KB
testcase_42 AC 262 ms
84,944 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