← All problemsSign in

B - Chef and his Guests

Chef has to serve two guests. He is having $n$ fruits numbered from 1 to n. The fruit $i$ increases the power of the guest by $p_i$. Each guest must receive at least one fruit and one fruit should be received by only one guest. Divide the fruits among the two guests such that the $absolute$ $difference$ between the maximum power fruit received by the first guest and the minimum power fruit

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