← All problemsSign in

Chef and the Feast

CodeChefRating 1633Open on judge ↗

Chef has prepared a feast with N dishes for you. You like Chef's cooking, and so you want to eat all the dishes he has prepared for you. You are also given an array A of size N, where Ai represents the happiness you get by eating the i-th dish.You will eat all the dishes in a series of steps. In each step, you pick a non empty subset of the remaining dishes and eat them. The happiness you get from

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