Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopdynamic-programming · scheduling
The organizer’s problem statement is available at the official source link.
duty schedule
Never leave three consecutive days unassigned
Choose the minimum-cost duty days while every run of skipped days has length at most two.
dutyskipskipduty
- 1
Track skipped days
Let the state record how many consecutive days have been skipped. - 2
Choose duty or skip
For each day, either pay its activity cost and reset the skip count, or skip if fewer than two days have been skipped. - 3
Minimize total time
Take the least-cost state after the final day.
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.