結果
| 問題 |
No.3281 Pacific White-sided Dolphin vs Monster
|
| コンテスト | |
| ユーザー |
nikoro256
|
| 提出日時 | 2025-09-26 23:25:26 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 851 ms / 2,000 ms |
| コード長 | 641 bytes |
| コンパイル時間 | 224 ms |
| コンパイル使用メモリ | 82,840 KB |
| 実行使用メモリ | 101,444 KB |
| 最終ジャッジ日時 | 2025-10-03 17:37:48 |
| 合計ジャッジ時間 | 14,710 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 51 |
ソースコード
def binary_search(f):
left,right=0,10**5 + 80
while right-left>1:
mid=(right+left)//2
if f(mid):
right=mid
else:
left=mid
return right
def f(x):
hq = [-h for h in H]
heapq.heapify(hq)
for i in range(x-1,-1,-1):
if len(hq) == 0:
break
if i>=60:
t = 2**60
else:
t = 2**i
p = heapq.heappop(hq)
p += t
if p<0:
heapq.heappush(hq, p)
if len(hq) == 0:
return True
return False
import heapq
N=int(input())
H=list(map(int,input().split()))
print(binary_search(f))
nikoro256