結果

問題 No.3281 Pacific White-sided Dolphin vs Monster
ユーザー detteiuu
提出日時 2025-09-26 22:55:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 167 ms / 2,000 ms
コード長 396 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 82,308 KB
実行使用メモリ 95,916 KB
最終ジャッジ日時 2025-09-26 22:55:07
合計ジャッジ時間 6,067 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappush, heappop

N = int(input())
H = sorted(list(map(int, input().split())))

MAX = max(H[i].bit_length()-i-1 for i in range(N))

que = []
for h in H:
    heappush(que, -h)

cnt = MAX+N-1
for _ in range(MAX+N):
    if not que:
        break
    n = -heappop(que)
    n -= 1<<min(cnt, 60)
    cnt -= 1
    if 1 <= n:
        heappush(que, -n)

print(N+MAX+1 if que else N+MAX)
0