結果
問題 |
No.3281 Pacific White-sided Dolphin vs Monster
|
ユーザー |
|
提出日時 | 2025-09-26 23:27:41 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 891 ms / 2,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 373 ms |
コンパイル使用メモリ | 82,844 KB |
実行使用メモリ | 98,376 KB |
最終ジャッジ日時 | 2025-09-26 23:28:09 |
合計ジャッジ時間 | 17,047 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 50 |
ソースコード
import heapq n=int(input()) h=list(map(int,input().split())) #print(h) lef=n-1 rig=n+80 S=sum(h) while(rig-lef>1) : mid=(rig+lef)//2 hq=[] if(mid<=60 and 2**mid-1<S) : lef=mid continue heapq.heapify(hq) for i in range(n) : heapq.heappush(hq,-h[i]) for i in range(mid-1,-1,-1): if(len(hq)==0) : break dec=min(1<<i,10**18+1) p=heapq.heappop(hq)*-1 if(p-dec>0) : heapq.heappush(hq,-(p-dec)) if(len(hq)==0) : rig=mid else : lef=mid print(rig)