Equal Gifts
Although Christmas has long since passed, Mr. and Mrs. J have a pile of $N$ unopened gifts with values $a_1, a_2, \ldots, a_N$. They wish to distribute some (possibly all) of the gifts amongst their two children Alice and Bob, and give the rest away to charity. They must do so in such a manner that: - Alice and Bob get at least one gift each - each gift is given to at most one of the children
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