← All problemsSign in

Ball Distribution

CodeChefRating 1442Open on judge ↗

Chef has $N$ empty boxes. There are $M$ different colours numbered from $1$ to $M$ such that Chef has $A_i$ balls of the $i^{th}$ colour. A distribution of these balls into boxes is said to be *valid* if: - Each ball is placed in a box; - All the balls in a box are of different colour. Over all *valid* distributions, find the **minimum** number of boxes having $M$ balls. Under the given constra

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