結果
問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
ユーザー |
![]() |
提出日時 | 2021-11-12 22:22:18 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,773 ms / 3,000 ms |
コード長 | 649 bytes |
コンパイル時間 | 851 ms |
コンパイル使用メモリ | 82,016 KB |
実行使用メモリ | 139,232 KB |
最終ジャッジ日時 | 2024-11-25 19:25:50 |
合計ジャッジ時間 | 33,650 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
n,a,b,x,y = map(int,input().split()) H = list(map(lambda x:-int(x),input().split())) import heapq # print(q) def isok(mid): h = list(map(lambda x:min(0,x+mid),H)) heapq.heapify(h) b_sum = b*y # print(h,mid) for i in range(a): aa = heapq.heappop(h) aa = min(aa+x,0) heapq.heappush(h,aa) h = list(map(lambda x:-int(x),h)) # print(h) for i in range(n): d = min(b_sum,h[i]) h[i] -= d b_sum -= d if sum(h) == 0:return True else:return False l = -1 r = -min(H) while r-l > 1: mid = (r+l) //2 if isok(mid): r = mid else: l = mid print(r)