Grid Tour
CodeChefOpen on judge ↗
Chef has an integer $K$ and a grid with $N$ rows (numbered $0$ through $N-1$) and $M$ columns (numbered $0$ through $M-1$). Let's denote the cell in row $r$ and column $c$ by $(r, c)$. A *tour* in the grid is a sequence of cells such that each cell of the grid occurs in this sequence at least once. The starting cell may be chosen arbitrarily. Then, for each cell $(x, y)$ except the final cell (bu
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.
Sign in to chat with the tutor and save your progress.
Sign in to start