← CSES Better

2 Two Paths - INOI 2018

INOI · 2018 · Indian National Olympiad in Informatics · TWOPATHS

Open official problem ↗
Ask AI

Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.

Open Claude Desktop

grid · 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.

Problem grid; highlighted cells show the illustrated path
path Aseparate.
.separate.
.separatepath B
  1. 1

    Track both paths

    Track both paths’ columns and diagonal-move budgets as they rise one row at a time.
  2. 2

    Reject intersections

    Reject states where paths intersect or violate the starting separation.
  3. 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 chars

Run output

Run your code to see output.