Please sign in to comment.
The binary search routine was subtly wrong.
Consider the case when we're searching for a tile >= (2, 3), but we don't have any tiles with x=2. Instead, we have tiles starting with (7, 1). The binary search will find the (7, 1) tile and pass it to the result processing routine, which is wrong (we don't want this tile). We now check explicitly that the found tile has the same x as the min_x we're interested in (if not, just set min_x to the newly found x and continue). This now passes the integration test, and I *think* have a (hand-wavish) proof of why this always works.
- Loading branch information...