Decorate House
CodeChefOpen on judge ↗
David wants to decorate his home for the Christmas so he decided to paint the path from his house to the gate. The path consists of n consecutive tiles, numbered from 1 to n. David will paint each tile in some color. He will consider the path beautiful if for any two different tiles with numbers i and j, such that |j−i| is a divisor of n greater than 1, they have the same color. Formally, the colo
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