← All problemsSign in

Go Away, Goose!

CodeChefRating 2866Open on judge ↗

There's an $N\times M$ grid. The top-left cell is labelled $(1, 1)$ and the bottom-right is $(N, M)$. Each cell is either empty, or has a goose in it. You want to go from $(1, 1)$ to $(N, M)$, moving only right or down in one step — that is, from $(x, y)$ you can move to either $(x+1, y)$ or $(x, y+1)$. It takes $A_{x, y}$ seconds to step onto cell $(x, y)$. It is guaranteed that $A_{1, 1}

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start