結果

問題 No.3281 Pacific White-sided Dolphin vs Monster
ユーザー Leal-0
提出日時 2025-09-26 23:05:21
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 488 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 82,608 KB
実行使用メモリ 128,728 KB
最終ジャッジ日時 2025-09-26 23:05:28
合計ジャッジ時間 6,559 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

import heapq
n=int(input())
h=list(map(int,input().split()))
#print(h)
lef=-1
rig=80
while(rig-lef>1) :
    mid=(rig+lef)//2
    hq=[]
    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=1<<i
        p=-hq[0]
        heapq.heappop(hq)
        if(p-dec>0) :
            heapq.heappush(hq,-(p-dec))
    if(len(hq)==0) :
        rig=mid
    else :
        lef=mid

print(rig)
0