結果

問題 No.3281 Pacific White-sided Dolphin vs Monster
ユーザー titia
提出日時 2025-09-29 22:17:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 566 bytes
コンパイル時間 1,873 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 21,792 KB
最終ジャッジ日時 2025-09-29 22:18:06
合計ジャッジ時間 42,858 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 40 TLE * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from heapq import heappop,heappush

N=int(input())
A=list(map(int,input().split()))

A.sort(reverse=True)

OK=10**5
NG=0

while OK>NG+1:
    mid=(OK+NG)//2

    H=[]
    for a in A:
        heappush(H,-a)

    for i in range(mid-1,-1,-1):
        if i>=65:
            d=10**18
        else:
            d=(1<<i)

        x=-heappop(H)

        x-=d

        if x>0:
            heappush(H,-x)

        if len(H)==0:
            break

    if len(H)==0:
        OK=mid
    else:
        NG=mid

print(OK)
            
        
0