Colorfulness of the squares
CodeChefOpen on judge ↗
You have n square blocks arranged in a straight line. Every block has a number written on it. And each block has a color associated with it. A sub-sequence of blocks has "colorfulness" equal to the number of distinct colors in that sub-sequence. An increasing sub-sequence is a sub-sequence of blocks where the numbers on the blocks are arranged in non-decreasing order. You are given a q number of
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