Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktoparrays · nonincreasing-values · index-distance · optimization
The organizer’s problem statement is available at the official source link.
index sequence distance
Maximize the minimum adjacent index gap
Choose L indices in any order, allowing an index to repeat, so their A-values are nonincreasing. The cost is the minimum absolute gap between adjacent indices.
| Position in sequence | Index | Required value relation |
|---|---|---|
| 1 | i1 | A[i1] |
| 2 | i2 | A[i1] >= A[i2] |
| ... | ... | ... |
| L | iL | cost = min adjacent |ij-i(j+1)| |
- 1
Choose an index sequence
A sequence has length L; indices may repeat and have no required ordering. - 2
Enforce value order
The selected values must satisfy A[i1] >= A[i2] >= ... >= A[iL]. - 3
Maximize its cost
For each valid sequence, take the minimum |ij - i(j+1)|; maximize that minimum over all sequences.
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.