結果
| 問題 | No.3281 Pacific White-sided Dolphin vs Monster |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-12 11:57:52 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 992 bytes |
| 記録 | |
| コンパイル時間 | 83 ms |
| コンパイル使用メモリ | 82,468 KB |
| 実行使用メモリ | 324,444 KB |
| 最終ジャッジ日時 | 2026-10-12 11:58:48 |
| 合計ジャッジ時間 | 6,906 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 TLE * 1 -- * 35 |
ソースコード
import heapq
N = int(input())
heap = sorted(list(map(int,input().split())))
hmax = heap[-1]
kmax = 0
while 1<<kmax<=hmax:
kmax += 1
low = N-1
high = N+kmax
while high-low>1:
heap0 = heap[:]
M0 = len(heap0)
mid = (high+low)//2
cnt = 0
for i in range(mid):
if M0==0:break
cnt += 1
heap1 = []
M1 = 0
M2 = M0
for _ in range(M2):
h = heapq.heappop(heap0)
M0 -= 1
if h>>i & 1:
h -= 1<<i
if h>0:
heapq.heappush(heap1,h)
M1 += 1
break
if h%(1<<i)>0:
h -= 1<<i
if h>0:
heapq.heappush(heap1,h)
M1 += 1
break
heapq.heappush(heap1,h)
M1 += 1
heap0 += heap1
heap0 = sorted(heap0)
M0 += M1
if M0==0:
high = mid
else:
low = mid
print(high)