Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopdynamic-programming · sequence
The organizer’s problem statement is available at the official source link.
no three consecutive
Track the last two match choices
The player may skip a match, but a valid schedule cannot include three consecutive matches.
playplayskipplay
- 1
Track recent choices
At each match, compare skipping with playing after zero or one immediately previous plays. - 2
Compare play or skip
Carry the best earned fees for these recent-choice states. - 3
Maximize fees
The best final state is the maximum valid 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.