← CSES Better

Frog jumping

INOI · 2005 · Indian National Olympiad in Informatics · INOI0501

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 · shortest-path · dynamic-programming

The organizer’s problem statement is available at the official source link.

launcher grid

Find the fewest launcher jumps across the board

Each cell gives maximum rightward and downward jump lengths. The diagram is symbolic, not a sample board.

Problem grid; highlighted cells show the illustrated path
start: (R1,D1)right <= R1...
down <= D1(Rij,Dij)...
......goal
  1. 1

    Read each launcher

    A cell (i,j) allows a right jump of 1..R[i,j] cells or a down jump of 1..D[i,j] cells.
  2. 2

    Move between cells

    Treat every legal jump as one edge from the current cell to its landing cell.
  3. 3

    Minimize jumps

    Find the fewest jumps from the top-left cell to the bottom-right; report unreachable when no route exists.
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.