Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopgrid · subgrid · optimization
The organizer’s problem statement is available at the official source link.
max profit square
Find the available square subgrid with maximum profit
Grid entries are field profits or losses; zero marks a field not for sale. The cells shown are symbolic, not a sample farm.
| p11 | p12 | X |
| p21 | p22 | p23 |
| p31 | p32 | p33 |
- 1
Read the farm grid
Each nonzero cell has a profit or loss; zero marks a reserved field. - 2
Choose a square
The purchased fields must form a square subgrid containing no reserved cell. - 3
Maximize profit
Find the allowed square whose cell values have the greatest total.
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.