Little Elephant and Blocks
Little Elephant from Zoo of Lviv has n (0-based numeration) blocks consisted of 1x1x1 cubes in such way that the size of i-th block is 1x1xAi. Each of the blocks also has a color, which is a positive integer. The color of i-th block is Ci. There will be no more than two blocks of the same color. Little Elephant wants to stack the blocks in the stack. In order to do so, he choose some random permu
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