結果
| 問題 | No.3281 Pacific White-sided Dolphin vs Monster | 
| コンテスト | |
| ユーザー |  timi | 
| 提出日時 | 2025-09-26 21:39:38 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 895 ms / 2,000 ms | 
| コード長 | 503 bytes | 
| コンパイル時間 | 159 ms | 
| コンパイル使用メモリ | 82,388 KB | 
| 実行使用メモリ | 145,652 KB | 
| 最終ジャッジ日時 | 2025-10-03 17:36:11 | 
| 合計ジャッジ時間 | 15,670 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 51 | 
ソースコード
#N,X,Q=map(int, input().split())
N=int(input())
H=list(map(int, input().split()))
H=sorted(H)
ng,ok=0,100+N+1
import heapq
while ok-ng>1:
  mid=(ok+ng)//2 
  C=[1]
  for i in range(mid-1):
    C.append(C[-1]*2)
    if C[-1]>10**18:
      C[-1]=10**18
      
  E=[]
  for h in H:
    heapq.heappush(E,-h)
  for c in C[::-1]:
    d=heapq.heappop(E)
    d*=-1 
    e=d-c 
    if e>0:
      heapq.heappush(E,-e)
    if len(E)==0:
      break
      
  if len(E)==0:
    ok=mid 
  else:
    ng=mid
print(ok)
            
            
            
        