結果
| 問題 | No.3281 Pacific White-sided Dolphin vs Monster |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-10-12 12:24:59 |
| 言語 | PyPy3 (8.0.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 759 bytes |
| 記録 | |
| コンパイル時間 | 62 ms |
| コンパイル使用メモリ | 81,708 KB |
| 実行使用メモリ | 179,308 KB |
| 最終ジャッジ日時 | 2026-10-12 12:25:24 |
| 合計ジャッジ時間 | 6,107 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 50 WA * 1 |
ソースコード
import heapq
N = int(input())
heap = sorted(list(map(int,input().split())))
M = len(heap)
hmax = heap[-1]
kmax = 0
while 1<<kmax<=hmax:
kmax += 1
cnt = 0
for i in range(kmax):
if M==0:break
cnt += 1
heap1 = []
M1 = 0
M2 = M
for _ in range(M2):
h = heapq.heappop(heap)
M -= 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
heap += heap1
M += M1
heap = sorted(heap)
if M==0:
print(cnt)
else:
print(cnt+M)