結果
問題 | No.1739 Princess vs. Dragoness (& AoE) |
ユーザー |
![]() |
提出日時 | 2023-05-11 08:58:15 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,442 ms / 3,000 ms |
コード長 | 665 bytes |
コンパイル時間 | 900 ms |
コンパイル使用メモリ | 81,804 KB |
実行使用メモリ | 122,464 KB |
最終ジャッジ日時 | 2024-11-27 09:21:51 |
合計ジャッジ時間 | 18,330 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 |
ソースコード
from heapq import * def check(m): L = [] for h in H: if h - m > 0: L.append(-h + m) heapify(L) AA = A while AA and L: v = -heappop(L) if v >= X: n = min(AA, v//X) v -= X * n AA -= n if v: heappush(L, -v) else: AA -= 1 L.append(0) return -sum(L) <= B * Y N, A, B, X, Y = map(int, input().split()) H = list(map(int, input().split())) if check(0): print(0) exit() no = 0 yes = 10 ** 9 + 5 while yes - no != 1: mid = (yes + no)//2 if check(mid): yes = mid else: no = mid print(yes)