結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー googol_S0googol_S0
提出日時 2021-11-12 21:46:46
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,760 ms / 3,000 ms
コード長 596 bytes
コンパイル時間 222 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 144,824 KB
最終ジャッジ日時 2024-05-04 08:09:29
合計ジャッジ時間 37,483 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,224 KB
testcase_01 AC 44 ms
52,620 KB
testcase_02 AC 45 ms
53,248 KB
testcase_03 AC 40 ms
52,608 KB
testcase_04 AC 2,009 ms
138,972 KB
testcase_05 AC 2,760 ms
139,460 KB
testcase_06 AC 80 ms
85,376 KB
testcase_07 AC 38 ms
52,736 KB
testcase_08 AC 465 ms
92,520 KB
testcase_09 AC 632 ms
104,280 KB
testcase_10 AC 796 ms
85,888 KB
testcase_11 AC 56 ms
69,120 KB
testcase_12 AC 47 ms
64,768 KB
testcase_13 AC 1,183 ms
108,068 KB
testcase_14 AC 1,671 ms
122,476 KB
testcase_15 AC 1,879 ms
144,824 KB
testcase_16 AC 1,233 ms
87,040 KB
testcase_17 AC 843 ms
103,308 KB
testcase_18 AC 1,589 ms
100,948 KB
testcase_19 AC 461 ms
96,816 KB
testcase_20 AC 54 ms
68,228 KB
testcase_21 AC 1,331 ms
132,448 KB
testcase_22 AC 1,870 ms
129,980 KB
testcase_23 AC 1,817 ms
135,288 KB
testcase_24 AC 2,511 ms
142,508 KB
testcase_25 AC 2,515 ms
140,832 KB
testcase_26 AC 1,781 ms
129,624 KB
testcase_27 AC 2,522 ms
140,728 KB
testcase_28 AC 80 ms
86,272 KB
testcase_29 AC 2,507 ms
140,712 KB
testcase_30 AC 2,142 ms
139,540 KB
testcase_31 AC 81 ms
86,272 KB
testcase_32 AC 78 ms
86,016 KB
testcase_33 AC 87 ms
76,544 KB
testcase_34 AC 38 ms
52,480 KB
testcase_35 AC 40 ms
58,880 KB
testcase_36 AC 42 ms
58,240 KB
testcase_37 AC 40 ms
52,608 KB
testcase_38 AC 102 ms
75,924 KB
testcase_39 AC 92 ms
76,032 KB
testcase_40 AC 86 ms
76,092 KB
testcase_41 AC 105 ms
75,996 KB
testcase_42 AC 83 ms
75,904 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
  if b>A*X+B*Y:
    return 0
  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