結果
問題 |
No.1739 Princess vs. Dragoness (& AoE)
|
ユーザー |
![]() |
提出日時 | 2021-11-12 22:06:48 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 775 bytes |
コンパイル時間 | 310 ms |
コンパイル使用メモリ | 82,400 KB |
実行使用メモリ | 234,236 KB |
最終ジャッジ日時 | 2024-11-25 18:49:40 |
合計ジャッジ時間 | 106,171 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 7 TLE * 25 |
ソースコード
import heapq def is_ok(K): HH = [0]*N for i in range(N): HH[i]=H[i]-K HQ = [] for i in range(N): heapq.heappush(HQ,(-HH[i],i)) for _ in range(A): hi,i = heapq.heappop(HQ) HH[i]-=X heapq.heappush(HQ,(-HH[i],i)) for i in range(B): y = Y j = 0 while y>0 and j<N: d = min(y,HH[j]) if d>0: HH[j]-=d y-=d j+=1 return max(HH)<=0 def meguru_bisect(ok, ng): while (abs(ok - ng) > 1): mid = (ok + ng) // 2 if is_ok(mid): ok = mid else: ng = mid return ok N,A,B,X,Y = map(int, input().split()) H = list(map(int, input().split())) print(meguru_bisect(10**9 + 1,0))