← All problemsSign in

Ada King

CodeChefRating 1378Open on judge ↗

Chef Ada is training her calculation skills. She wants to place a king and some obstacles on a chessboard in such a way that the number of distinct cells the king can reach is exactly $K$. Recall that a chessboard has $8$ rows (numbered $1$ through $8$) and $8$ columns (numbered $1$ through $8$); let's denote a cell in row $r$ and column $c$ by $(r,c)$. In one move, a king can move to any adjace

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