結果

問題 No.1739 Princess vs. Dragoness (& AoE)
ユーザー とりゐとりゐ
提出日時 2021-10-29 14:54:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 678 ms / 3,000 ms
コード長 434 bytes
コンパイル時間 406 ms
コンパイル使用メモリ 86,728 KB
実行使用メモリ 114,380 KB
最終ジャッジ日時 2023-08-16 20:54:39
合計ジャッジ時間 17,154 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,060 KB
testcase_01 AC 74 ms
71,148 KB
testcase_02 AC 73 ms
71,016 KB
testcase_03 AC 74 ms
71,236 KB
testcase_04 AC 647 ms
100,196 KB
testcase_05 AC 675 ms
92,236 KB
testcase_06 AC 198 ms
114,180 KB
testcase_07 AC 73 ms
71,192 KB
testcase_08 AC 391 ms
89,248 KB
testcase_09 AC 514 ms
90,856 KB
testcase_10 AC 270 ms
85,748 KB
testcase_11 AC 234 ms
83,704 KB
testcase_12 AC 96 ms
76,316 KB
testcase_13 AC 432 ms
95,548 KB
testcase_14 AC 507 ms
88,540 KB
testcase_15 AC 656 ms
100,144 KB
testcase_16 AC 239 ms
82,408 KB
testcase_17 AC 362 ms
91,828 KB
testcase_18 AC 317 ms
83,260 KB
testcase_19 AC 237 ms
87,688 KB
testcase_20 AC 206 ms
81,212 KB
testcase_21 AC 470 ms
91,340 KB
testcase_22 AC 585 ms
94,968 KB
testcase_23 AC 664 ms
114,156 KB
testcase_24 AC 667 ms
92,804 KB
testcase_25 AC 627 ms
91,876 KB
testcase_26 AC 645 ms
114,380 KB
testcase_27 AC 663 ms
92,180 KB
testcase_28 AC 646 ms
112,372 KB
testcase_29 AC 678 ms
92,392 KB
testcase_30 AC 648 ms
100,328 KB
testcase_31 AC 647 ms
107,312 KB
testcase_32 AC 649 ms
92,124 KB
testcase_33 AC 81 ms
75,528 KB
testcase_34 AC 74 ms
71,424 KB
testcase_35 AC 82 ms
75,584 KB
testcase_36 AC 72 ms
71,432 KB
testcase_37 AC 72 ms
71,068 KB
testcase_38 AC 81 ms
75,600 KB
testcase_39 AC 88 ms
75,588 KB
testcase_40 AC 83 ms
75,456 KB
testcase_41 AC 83 ms
75,464 KB
testcase_42 AC 82 ms
76,100 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