Distributing chocolates
CodeChefOpen on judge ↗
Aakash likes distributing chocolates to children on his girlfriend's birthday. He has $N$ boxes of chocolates with him. Each box $i$ has $a$i chocolates. There are $N$ children standing in a line to get a box of chocolates. Each child gets one box of chocolate. Giving a box of $x$ chocolates to a child takes $x$ amount of time. Each child has to wait until all the children standing before him/her
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