結果
| 問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
| コンテスト | |
| ユーザー |
ntuda
|
| 提出日時 | 2025-06-07 16:44:12 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 1,875 ms / 3,000 ms |
| コード長 | 474 bytes |
| コンパイル時間 | 636 ms |
| コンパイル使用メモリ | 82,180 KB |
| 実行使用メモリ | 137,496 KB |
| 最終ジャッジ日時 | 2025-06-07 16:44:49 |
| 合計ジャッジ時間 | 34,455 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 40 |
ソースコード
from heapq import *
N,A,B,X,Y = map(int,input().split())
H = list(map(int,input().split()))
def check(x):
Q = []
for h in H:
if h - x > 0:
heappush(Q,x - h)
for _ in range(A):
if Q:
a = heappop(Q)
if a + X < 0:
heappush(Q,a+X)
return -sum(Q) <= B * Y
lb = -1
ub = 10 ** 9
while ub - lb > 1:
mid = (ub + lb) // 2
if check(mid):
ub = mid
else:
lb = mid
print(ub)
ntuda