← CSES Better
Open official problem ↗2 Two Paths - INOI 2018
INOI · 2018 · Indian National Olympiad in Informatics · TWOPATHS
Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude Desktopgrid · dynamic-programming · paths
The organizer’s problem statement is available at the official source link.
two grid paths
Keep two nonintersecting paths around the scored region
Each path moves upward and at most K times diagonally left; the score is the cells between the paths.
| path A | separate | . |
| . | separate | . |
| . | separate | path B |
- 1
Track both paths
Track both paths’ columns and diagonal-move budgets as they rise one row at a time. - 2
Reject intersections
Reject states where paths intersect or violate the starting separation. - 3
Maximize enclosed sum
Add the row’s cells between the paths and maximize the accumulated score.
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.