← All problemsSign in

Nutrition Cost

CodeChefRating 1191Open on judge ↗

There are $N$ different food items, each providing an essential vitamin $A_i$ and costing $B_i$. There is an integer parameter $C$ which represents the value of a single vitamin to you. You will buy some of the food items to maximize $C \cdot X - Y$ ($C$ multiplied by $X$ minus $Y$), where $X$ represents the number of **distinct** vitamins eaten, and $Y$ represents the total cost of all the food

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