結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー googol_S0googol_S0
提出日時 2021-11-12 21:46:09
言語 PyPy3
(7.3.15)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 567 bytes
コンパイル時間 319 ms
コンパイル使用メモリ 87,188 KB
実行使用メモリ 145,416 KB
最終ジャッジ日時 2023-08-17 00:48:46
合計ジャッジ時間 46,225 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
71,388 KB
testcase_01 AC 81 ms
71,580 KB
testcase_02 AC 84 ms
71,404 KB
testcase_03 AC 81 ms
71,264 KB
testcase_04 AC 2,463 ms
139,292 KB
testcase_05 TLE -
testcase_06 AC 128 ms
91,924 KB
testcase_07 AC 84 ms
71,432 KB
testcase_08 AC 592 ms
94,680 KB
testcase_09 AC 777 ms
106,032 KB
testcase_10 AC 1,002 ms
92,704 KB
testcase_11 AC 109 ms
79,188 KB
testcase_12 AC 195 ms
78,812 KB
testcase_13 AC 1,458 ms
107,616 KB
testcase_14 AC 2,093 ms
122,968 KB
testcase_15 AC 2,371 ms
145,416 KB
testcase_16 AC 1,454 ms
89,364 KB
testcase_17 AC 1,031 ms
99,056 KB
testcase_18 AC 1,941 ms
102,388 KB
testcase_19 AC 590 ms
98,096 KB
testcase_20 AC 100 ms
78,380 KB
testcase_21 AC 1,621 ms
131,896 KB
testcase_22 AC 1,892 ms
130,656 KB
testcase_23 AC 2,008 ms
138,500 KB
testcase_24 TLE -
testcase_25 TLE -
testcase_26 AC 2,090 ms
130,668 KB
testcase_27 TLE -
testcase_28 AC 127 ms
91,644 KB
testcase_29 AC 2,992 ms
140,680 KB
testcase_30 AC 2,559 ms
142,200 KB
testcase_31 AC 128 ms
91,804 KB
testcase_32 AC 128 ms
91,516 KB
testcase_33 AC 132 ms
77,600 KB
testcase_34 AC 79 ms
71,236 KB
testcase_35 AC 80 ms
75,976 KB
testcase_36 AC 82 ms
75,956 KB
testcase_37 AC 79 ms
71,264 KB
testcase_38 AC 142 ms
78,032 KB
testcase_39 AC 136 ms
77,548 KB
testcase_40 AC 120 ms
77,448 KB
testcase_41 AC 143 ms
77,700 KB
testcase_42 AC 128 ms
77,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,A,B,X,Y=map(int,input().split())
H=list(map(int,input().split()))
L,R=0,10**9
from heapq import *
def f(m):
  a=0
  b=0
  for i in range(N):
    a+=max(H[i]-m,0)
    b+=(max(H[i]-m,0)+X-1)//X
  if b<=A or a<=B*Y:
    return 1
  Q=[]
  heapify(Q)
  for i in range(N):
    heappush(Q,-max(0,H[i]-m))
  for i in range(A):
    x=heappop(Q)
    if x==0:
      return 1
    x=-x
    heappush(Q,-max(0,x-X))
  s=0
  while len(Q):
    s-=heappop(Q)
  if s<=B*Y:
    return 1
  else:
    return 0

while L<R:
  M=(L+R)>>1
  if f(M):
    R=M
  else:
    L=max(L+1,M)
print(L)
0