← CSES Better

Little Red Riding Hood

ZCO · 2013 · Zonal Computing Olympiad · ZCO13002

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 · manhattan-distance

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

grid path

Build a safe monotone path

A charm protects cells in a Manhattan-radius diamond; legal paths move only right or down and collect cell berries.

Problem grid; highlighted cells show the illustrated path
Spath.
pathcharm.
..G
  1. 1

    Mark safe cells

    Mark every cell covered by at least one charm’s Manhattan radius.
  2. 2

    Propagate best paths

    Use a grid DP over safe cells, entering only from above or the left.
  3. 3

    Maximize berries

    Carry the best berry total to the bottom-right destination.
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.