Deque has lines with intersections at . Query for . Binary search: , , . The optimal line is between intersections 7 and 12.
With sorted queries: if last query was , pointer was at line after intersection 7. For , pointer stays (still before intersection 12). Amortized per query: pointer only moves right. Total movement across all queries is .