Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopdynamic-programming · cycle · optimization
The organizer’s problem statement is available at the official source link.
cycle cover
Cover every edge of the round table
Choosing a knight covers the two neighboring table edges; minimize the selected dessert costs around a cycle. Schematic structure only; vertices and edges represent the task relation, not an official sample. Schematic graph only; labels and edges show the task relation, not an official sample.
- 1
Cover each edge
View each adjacent pair as an edge that must touch a chosen endpoint. - 2
Handle cycle boundary
Fix whether the first knight is selected, then use a two-state DP for the remaining cycle. - 3
Minimize cost
Check the wraparound edge and choose the cheaper valid case.
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.