結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー suosuo
提出日時 2021-11-12 22:00:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 281 ms / 3,000 ms
コード長 625 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 87,360 KB
実行使用メモリ 207,280 KB
最終ジャッジ日時 2023-08-17 01:25:40
合計ジャッジ時間 9,250 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,332 KB
testcase_01 AC 74 ms
71,460 KB
testcase_02 AC 70 ms
71,332 KB
testcase_03 AC 69 ms
71,548 KB
testcase_04 AC 267 ms
120,468 KB
testcase_05 AC 281 ms
137,216 KB
testcase_06 AC 252 ms
207,280 KB
testcase_07 AC 68 ms
71,496 KB
testcase_08 AC 156 ms
135,788 KB
testcase_09 AC 232 ms
157,404 KB
testcase_10 AC 160 ms
93,996 KB
testcase_11 AC 125 ms
94,180 KB
testcase_12 AC 85 ms
76,804 KB
testcase_13 AC 201 ms
111,920 KB
testcase_14 AC 220 ms
130,840 KB
testcase_15 AC 251 ms
120,276 KB
testcase_16 AC 153 ms
86,328 KB
testcase_17 AC 166 ms
103,340 KB
testcase_18 AC 170 ms
107,732 KB
testcase_19 AC 162 ms
107,824 KB
testcase_20 AC 109 ms
89,316 KB
testcase_21 AC 226 ms
131,624 KB
testcase_22 AC 239 ms
114,464 KB
testcase_23 AC 259 ms
148,896 KB
testcase_24 AC 276 ms
133,000 KB
testcase_25 AC 252 ms
147,232 KB
testcase_26 AC 261 ms
131,636 KB
testcase_27 AC 251 ms
141,848 KB
testcase_28 AC 243 ms
128,704 KB
testcase_29 AC 269 ms
135,132 KB
testcase_30 AC 272 ms
121,420 KB
testcase_31 AC 248 ms
121,040 KB
testcase_32 AC 262 ms
137,760 KB
testcase_33 AC 76 ms
76,192 KB
testcase_34 AC 68 ms
71,416 KB
testcase_35 AC 75 ms
76,204 KB
testcase_36 AC 73 ms
75,540 KB
testcase_37 AC 70 ms
71,320 KB
testcase_38 AC 75 ms
75,932 KB
testcase_39 AC 78 ms
76,204 KB
testcase_40 AC 76 ms
76,468 KB
testcase_41 AC 75 ms
76,136 KB
testcase_42 AC 77 ms
76,072 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