Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopoptimization · greedy · queries
The organizer’s problem statement is available at the official source link.
upgrade cost
Spend upgrades where water use drops most
Vegetable i needs Ai units at Bi water per unit; an upgrade lowers either factor by one, and each query limits upgrades.
| Plot i | Water | One-step saving |
|---|---|---|
| i | A_i * B_i | reduce A_i -> save B_i |
| i | A_i * B_i | reduce B_i -> save A_i |
- 1
Compare marginal savings
Start with total water equal to the sum of Ai×Bi. - 2
Spend within budget
Compare each possible one-step reduction, whose benefit depends on the current other factor. - 3
Minimize water use
For every budget X, minimize total water using at most X upgrades.
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.