結果
| 問題 | No.1739 Princess vs. Dragoness (& AoE) |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-08-13 09:12:04 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 534 bytes |
| 記録 | |
| コンパイル時間 | 598 ms |
| コンパイル使用メモリ | 96,492 KB |
| 実行使用メモリ | 117,632 KB |
| 最終ジャッジ日時 | 2026-08-13 09:12:25 |
| 合計ジャッジ時間 | 17,973 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 35 WA * 5 |
ソースコード
import heapq
N,A,B,X,Y = map(int,input().split())
H = sorted(list(map(int,input().split())),reverse=True)
S = sum(H)
high = max(H)
low = -1
while high-low>1:
mid = (high+low)//2
if S<N*mid:
high = mid
continue
if S-N*mid>A*X+B*Y:
low = mid
continue
heap = [-max(0,H[i]-mid) for i in range(N)]
for _ in range(A):
h = -heapq.heappop(heap)
h = max(0,h-X)
heapq.heappush(heap,-h)
if -sum(heap)<=B*Y:
high = mid
else:
low = mid
print(high)