← All problemsSign in

Mixing flavors

CodeChefRating 2923Open on judge ↗

There are N ice-creams placed in a row in a shop, where the i-th has cost C[i] and flavor F[i]. Chef wants to buy some consecutive segment of ice-creams so that their total cost doesn't exceed his budget K, and he can mix some subset of bought ice-creams to make a new ice-cream with maximum possible flavor. Mixing m ice-creams of flavors A1, A2, .., Am will result in an ice-cream of flavor equal

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