Better Purchases
CodeChefOpen on judge ↗
You just purchased a general store and now you would like to stock up with some goods. You have N companies from which you can purchase. Also your store has M shelves, where the ith shelf can accommodate Ai units of goods (of any company). Any two goods from the same company has to be put in the same shelf. Also, a shelf cannot have goods from any two different companies. The companies have two c
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