← All problemsSign in

Fence Colouring

CodeChefRating 1131Open on judge ↗

You have $N$ fences, and you want to colour them. You have $N$ total types of colours numbered $1, 2, \ldots, N$. Currently, all the $N$ fences are coloured with the type $1$ colour. At the end, you want the $i$-th fence to have a colour of $A_i$ for every $1 \le i \le N$. You can choose to do one of the following at each minute: - Colour all $N$ fences at the same time with type $X$ colour, wh

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