K - The Perfect Tour
CodeChefOpen on judge ↗
There is a grid of $N \cdot M$ cells. It is guaranteed that $N \cdot M$ is even. Exactly half of the cells, i.e. $\frac{N \cdot M}{2}$ are coloured white. The rest are coloured black. Construct $2$ directed tournament$^\dagger$ graphs: one on the black cells, and another on the white cells. There are a total of $C(\frac{N \cdot M}{2}, 2)^{\ddagger}$ edges in each tournament graph. Thus, a total o
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