結果

問題 No.3281 Pacific White-sided Dolphin vs Monster
ユーザー hirayuu_yc
提出日時 2025-05-28 21:14:17
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 114 ms / 2,000 ms
コード長 480 bytes
コンパイル時間 370 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 110,920 KB
最終ジャッジ日時 2025-09-13 22:28:46
合計ジャッジ時間 5,790 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 50
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
H=list(map(int,input().split()))
H.sort()
ng=0
ok=N+100
while ok-ng>1:
    mid=(ok+ng)//2
    now=mid
    h=H[:]
    while h and now>61:
        now-=1
        h.pop()
    if not h:
        ok=mid
        continue
    if len(h)>now:
    	ng=mid
    	continue
    for i in range(now-1,-1,-1):
        mx=(-1,-1)
        for j in range(len(h)):
            mx=max(mx,(h[j],j))
        h[mx[1]]-=1<<i
    if max(h)<=0:
        ok=mid
    else:
        ng=mid
print(ok)
0