結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー suosuo
提出日時 2021-11-12 21:51:38
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 623 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 211,028 KB
最終ジャッジ日時 2024-05-04 08:20:30
合計ジャッジ時間 7,269 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
51,840 KB
testcase_01 AC 31 ms
51,968 KB
testcase_02 AC 34 ms
52,608 KB
testcase_03 AC 32 ms
52,096 KB
testcase_04 AC 223 ms
119,636 KB
testcase_05 WA -
testcase_06 AC 209 ms
211,028 KB
testcase_07 AC 34 ms
52,480 KB
testcase_08 AC 128 ms
137,524 KB
testcase_09 AC 177 ms
161,672 KB
testcase_10 AC 129 ms
92,812 KB
testcase_11 AC 96 ms
92,416 KB
testcase_12 AC 52 ms
75,264 KB
testcase_13 AC 164 ms
110,920 KB
testcase_14 WA -
testcase_15 AC 213 ms
118,324 KB
testcase_16 AC 109 ms
84,608 KB
testcase_17 AC 130 ms
101,488 KB
testcase_18 AC 138 ms
106,140 KB
testcase_19 AC 134 ms
108,660 KB
testcase_20 AC 75 ms
88,064 KB
testcase_21 AC 189 ms
130,688 KB
testcase_22 AC 195 ms
112,880 KB
testcase_23 AC 210 ms
147,472 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 201 ms
130,432 KB
testcase_27 WA -
testcase_28 AC 204 ms
128,556 KB
testcase_29 AC 218 ms
133,324 KB
testcase_30 AC 233 ms
119,596 KB
testcase_31 AC 230 ms
118,960 KB
testcase_32 AC 223 ms
136,472 KB
testcase_33 AC 42 ms
59,904 KB
testcase_34 AC 32 ms
51,712 KB
testcase_35 AC 38 ms
60,232 KB
testcase_36 AC 38 ms
58,112 KB
testcase_37 AC 32 ms
52,224 KB
testcase_38 AC 38 ms
60,800 KB
testcase_39 AC 39 ms
62,208 KB
testcase_40 AC 37 ms
60,800 KB
testcase_41 AC 39 ms
60,672 KB
testcase_42 AC 38 ms
60,288 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 = max(0,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