← All problemsSign in

Colored Array

CodeChefRating 1786Open on judge ↗

Chef had a hard time arguing with his friend, and after getting a great old kick Chef saw a colored array with N cells, numbered from 1 to N. The kick was so strong that Chef suddenly understood the rules of the game. - Each cell is painted with a color. Here the colors are numbered from 1 to M. - For any cell i, Chef can repaint it with any color q, and the cost of such operation is Ci,q point

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