Sugar Limit
Chef bought $N$ different snacks, and now needs to decide which ones to eat. The $i$-th snack has a tastiness of $A_i$, and contains $B_i$ units of sugar. Note that $A_i$ can be $0$ or even negative. Chef wants to limit his sugar intake, so he will choose some **non-negative integer** $L$, and then he can only eat a snack if it has at most $L$ units of sugar, i.e. that satisfies $B_i \le L$.
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