結果
| 問題 | No.3281 Pacific White-sided Dolphin vs Monster |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-12 11:53:26 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 991 bytes |
| 記録 | |
| コンパイル時間 | 889 ms |
| コンパイル使用メモリ | 81,144 KB |
| 実行使用メモリ | 97,272 KB |
| 最終ジャッジ日時 | 2026-10-12 11:54:10 |
| 合計ジャッジ時間 | 7,536 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_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
heapq.heapify(heap0)
M0 += M1
if M0==0:
high = mid
else:
low = mid
print(high)