結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー とりゐとりゐ
提出日時 2021-10-29 14:54:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 605 ms / 3,000 ms
コード長 434 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 112,868 KB
最終ジャッジ日時 2024-05-04 04:18:30
合計ジャッジ時間 14,715 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
52,096 KB
testcase_01 AC 37 ms
51,840 KB
testcase_02 AC 40 ms
52,224 KB
testcase_03 AC 36 ms
52,096 KB
testcase_04 AC 565 ms
98,048 KB
testcase_05 AC 605 ms
92,288 KB
testcase_06 AC 159 ms
110,464 KB
testcase_07 AC 36 ms
51,840 KB
testcase_08 AC 338 ms
88,668 KB
testcase_09 AC 454 ms
89,856 KB
testcase_10 AC 227 ms
83,456 KB
testcase_11 AC 205 ms
84,224 KB
testcase_12 AC 67 ms
71,424 KB
testcase_13 AC 387 ms
91,892 KB
testcase_14 AC 446 ms
87,936 KB
testcase_15 AC 569 ms
98,012 KB
testcase_16 AC 205 ms
80,768 KB
testcase_17 AC 316 ms
90,640 KB
testcase_18 AC 272 ms
83,236 KB
testcase_19 AC 212 ms
86,440 KB
testcase_20 AC 171 ms
79,744 KB
testcase_21 AC 409 ms
89,472 KB
testcase_22 AC 496 ms
93,724 KB
testcase_23 AC 592 ms
111,468 KB
testcase_24 AC 594 ms
93,056 KB
testcase_25 AC 555 ms
90,880 KB
testcase_26 AC 578 ms
112,868 KB
testcase_27 AC 582 ms
91,776 KB
testcase_28 AC 586 ms
112,308 KB
testcase_29 AC 603 ms
92,160 KB
testcase_30 AC 561 ms
101,132 KB
testcase_31 AC 595 ms
107,156 KB
testcase_32 AC 584 ms
92,160 KB
testcase_33 AC 52 ms
59,776 KB
testcase_34 AC 41 ms
52,352 KB
testcase_35 AC 52 ms
59,136 KB
testcase_36 AC 44 ms
52,224 KB
testcase_37 AC 43 ms
52,224 KB
testcase_38 AC 56 ms
61,184 KB
testcase_39 AC 60 ms
62,720 KB
testcase_40 AC 55 ms
60,544 KB
testcase_41 AC 51 ms
61,312 KB
testcase_42 AC 49 ms
60,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def is_ok(k,a,b,x,y):
  c=[max(0,i-k) for i in h]
  for i in range(n):
    d=min(a,c[i]//x)
    a-=d
    c[i]-=x*d
  c.sort(reverse=True)
  for i in range(n):
    if a>0:
      c[i]=0
      a-=1
  if sum(c)<=b*y:
    return True
  else:
    return False

n,a,b,x,y=map(int,input().split())
h=list(map(int,input().split()))
ng,ok=-1,10**9
while ok-ng>1:
  mid=(ng+ok)//2
  if is_ok(mid,a,b,x,y):
    ok=mid
  else:
    ng=mid
print(ok)
0