結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー qibqib
提出日時 2023-03-07 23:57:27
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 2,035 ms / 3,000 ms
コード長 466 bytes
コンパイル時間 1,510 ms
コンパイル使用メモリ 81,460 KB
実行使用メモリ 136,132 KB
最終ジャッジ日時 2023-10-18 05:40:27
合計ジャッジ時間 37,476 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,372 KB
testcase_01 AC 39 ms
53,372 KB
testcase_02 AC 39 ms
53,372 KB
testcase_03 AC 39 ms
53,372 KB
testcase_04 AC 1,384 ms
114,352 KB
testcase_05 AC 1,858 ms
123,436 KB
testcase_06 AC 595 ms
119,392 KB
testcase_07 AC 39 ms
53,380 KB
testcase_08 AC 252 ms
100,720 KB
testcase_09 AC 298 ms
101,736 KB
testcase_10 AC 890 ms
86,184 KB
testcase_11 AC 562 ms
87,916 KB
testcase_12 AC 65 ms
72,640 KB
testcase_13 AC 977 ms
110,584 KB
testcase_14 AC 1,196 ms
106,468 KB
testcase_15 AC 964 ms
117,120 KB
testcase_16 AC 1,132 ms
85,700 KB
testcase_17 AC 599 ms
95,352 KB
testcase_18 AC 1,180 ms
88,828 KB
testcase_19 AC 223 ms
81,372 KB
testcase_20 AC 223 ms
82,008 KB
testcase_21 AC 492 ms
93,788 KB
testcase_22 AC 954 ms
111,816 KB
testcase_23 AC 1,606 ms
132,268 KB
testcase_24 AC 1,831 ms
124,864 KB
testcase_25 AC 1,923 ms
111,848 KB
testcase_26 AC 1,578 ms
134,984 KB
testcase_27 AC 2,035 ms
118,228 KB
testcase_28 AC 1,625 ms
136,132 KB
testcase_29 AC 1,977 ms
117,048 KB
testcase_30 AC 1,655 ms
128,644 KB
testcase_31 AC 1,665 ms
134,948 KB
testcase_32 AC 1,894 ms
121,568 KB
testcase_33 AC 75 ms
73,060 KB
testcase_34 AC 39 ms
53,380 KB
testcase_35 AC 82 ms
75,832 KB
testcase_36 AC 91 ms
75,832 KB
testcase_37 AC 51 ms
61,412 KB
testcase_38 AC 85 ms
75,828 KB
testcase_39 AC 67 ms
72,412 KB
testcase_40 AC 61 ms
68,296 KB
testcase_41 AC 84 ms
75,772 KB
testcase_42 AC 73 ms
72,592 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq

n, a, b, x, y = map(int, input().split())
h = list(map(int, input().split()))

ok = 10 ** 9
ng = -1
while abs(ok - ng) > 1:
  mid = (ok + ng) // 2
  hp = []
  for i in range(n):
    if h[i] > mid:
      heapq.heappush(hp, - (h[i] - mid))

  rest = a
  while rest > 0 and len(hp) > 0:
    cur = heapq.heappop(hp)
    rest -= 1
    if - cur - x > 0:
      heapq.heappush(hp, cur + x)

  if - sum(hp) <= b * y:
    ok = mid
  else:
    ng = mid

print(ok)
0