Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopsorting · intervals · greedy
The organizer’s problem statement is available at the official source link.
timeline
Match a contest to teleport times
Choose one contest, one available inbound V time, and one outbound W time. Minimize the elapsed time t2 - t1 + 1 while arriving no later than the contest start and leaving no earlier than its end. Diagram positions are schematic.
arrival V
0–3
contest [S,E]
1–4
departure W
2–5
- 1
Choose a contest
For a contest [S,E], arrival at the centre must be at or before S and departure must be at or after E. - 2
Choose wormhole times
Use an inbound V time t1 <= S and an outbound W time t2 >= E. - 3
Minimize time away
Minimize t2 - t1 + 1 over all feasible contest and wormhole choices.
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.