結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー suosuo
提出日時 2021-11-12 22:00:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 253 ms / 3,000 ms
コード長 625 bytes
コンパイル時間 236 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 211,032 KB
最終ジャッジ日時 2024-05-04 08:39:40
合計ジャッジ時間 6,861 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 32 ms
51,840 KB
testcase_01 AC 32 ms
52,096 KB
testcase_02 AC 31 ms
52,096 KB
testcase_03 AC 34 ms
52,224 KB
testcase_04 AC 219 ms
120,076 KB
testcase_05 AC 253 ms
134,600 KB
testcase_06 AC 203 ms
211,032 KB
testcase_07 AC 33 ms
51,712 KB
testcase_08 AC 122 ms
137,016 KB
testcase_09 AC 171 ms
161,796 KB
testcase_10 AC 124 ms
92,544 KB
testcase_11 AC 91 ms
92,544 KB
testcase_12 AC 50 ms
75,392 KB
testcase_13 AC 160 ms
111,364 KB
testcase_14 AC 177 ms
123,800 KB
testcase_15 AC 204 ms
118,260 KB
testcase_16 AC 109 ms
85,120 KB
testcase_17 AC 128 ms
101,932 KB
testcase_18 AC 133 ms
106,268 KB
testcase_19 AC 134 ms
108,664 KB
testcase_20 AC 72 ms
88,436 KB
testcase_21 AC 185 ms
130,304 KB
testcase_22 AC 195 ms
112,504 KB
testcase_23 AC 210 ms
147,340 KB
testcase_24 AC 237 ms
132,040 KB
testcase_25 AC 229 ms
145,220 KB
testcase_26 AC 199 ms
130,360 KB
testcase_27 AC 204 ms
140,924 KB
testcase_28 AC 201 ms
128,364 KB
testcase_29 AC 218 ms
133,880 KB
testcase_30 AC 228 ms
119,596 KB
testcase_31 AC 215 ms
118,756 KB
testcase_32 AC 219 ms
135,956 KB
testcase_33 AC 39 ms
59,264 KB
testcase_34 AC 31 ms
51,968 KB
testcase_35 AC 38 ms
59,648 KB
testcase_36 AC 35 ms
57,472 KB
testcase_37 AC 32 ms
52,352 KB
testcase_38 AC 38 ms
60,032 KB
testcase_39 AC 40 ms
62,848 KB
testcase_40 AC 38 ms
60,672 KB
testcase_41 AC 39 ms
61,056 KB
testcase_42 AC 43 ms
60,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def ok(m):
  nh = []
  for i in h:
    nh.append(i-m)
  na = a
  for i in range(n):
    if nh[i] >= x:
      v = min(na,nh[i]//x)
      na -= v
      nh[i] -= v*x
    if na <= 0:
      break
  nh.sort()
  s = 0
  for i in range(n-1,-1,-1):
    if na > 0 and nh[i] > 0:
      na -= 1
      nh[i] -= x
    if nh[i] > 0:
      s += nh[i]
  if s <= b*y:
    return True
  return False
    
  

n,a,b,x,y = map(int,input().split())
h = list(map(int,sys.stdin.readline().split()))
h.sort()
l = 0
r = 10**9
while r - l > 1:
  m = (r + l) // 2
  if ok(m):
    r = m
  else:
    l = m
if ok(l):
  print(l)
else:
  print(r)
0