← All problemsSign in

Game on a Grid

CodeChefRating 3284Open on judge ↗

Alice and Bob are playing a game. A single pawn is placed on a grid. The grid consists of cells (X, Y) for non-negative integers X and Y. Some cells of the grid have been marked as impassable. A move consists of choosing some positive integer D and moving the pawn from (X, Y) either to (X − D, Y) or to (X, Y − D), of course, if this cell belongs to the grid. In other words, we move the pawn a posi

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