結果

問題 No.3281 Pacific White-sided Dolphin vs Monster
ユーザー hirayuu_yc
提出日時 2025-05-27 13:49:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 463 ms
コンパイル使用メモリ 82,244 KB
実行使用メモリ 99,860 KB
最終ジャッジ日時 2025-10-03 17:34:48
合計ジャッジ時間 7,253 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 51
権限があれば一括ダウンロードができます

ソースコード

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
    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