Recover Square
CodeChefOpen on judge ↗
A long time ago, a grid with $N$ rows and $N$ columns had mysteriously vanished. The cells of this grid contain integers $1$ through $N\cdot N$ in some order. You do not know this order, but some information remains to this day: $M$ pairs of cells with Manhattan distance $1$ or $2$. You should find a grid satisfying the following conditions (or decide that it does not exist): - The cells of the g
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