Roll the Bar
You are given a $1 \times 1 \times 2$ bar (a cuboid) and a grid $A$ with $N$ rows (numbered $1$ through $N$) and $M$ columns (numbered $1$ through $M$). Let's denote the cell in row $r$ and column $c$ by $(r, c)$. Some cells of the grid are blocked, the remaining cells are free. Each cell has dimensions $1 \times 1$, the same as two opposite faces of the cuboid. When the bar is placed on the grid
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