Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopbinary-search · sorting · simulation
The organizer’s problem statement is available at the official source link.
sample trace
Walking in Manhattan: binary search walkthrough
Walking in Manhattan: use the linked editorial?s binary search, sorting idea on the published sample, then verify the displayed output.
Published input4 5
V 7
H 4
H 5
V 6
6 3 10
6 4 10
6 5 10
6 6 10
100 4 10modelAlgorithm ideaSearch a monotone boundary by repeatedly testing a midpoint with the editorial?s feasibility condition.task resultExpected output14 5
7 13
6 15
6 16
110 4
- 1
Range
Set the candidate interval for the quantity the task asks to minimize or maximize. - 2
Test
Evaluate the task?s feasibility condition at the midpoint. - 3
Narrow
Keep the half containing the true boundary until the answer is determined. - 4
Verify the sample
Use the published sample output to check the result of this idea on the displayed input.
Tools
1
2
3
4
5
6
7
8
9
10
11
12
Draft saved locally
|12 lines, 156 charsRun output
Run your code to see output.