結果
| 問題 |
No.3281 Pacific White-sided Dolphin vs Monster
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-26 23:27:41 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 997 ms / 2,000 ms |
| コード長 | 568 bytes |
| コンパイル時間 | 253 ms |
| コンパイル使用メモリ | 82,604 KB |
| 実行使用メモリ | 98,396 KB |
| 最終ジャッジ日時 | 2025-10-03 17:37:58 |
| 合計ジャッジ時間 | 17,536 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
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)