← All problemsSign in

More Cookies

CodeChefRating 890Open on judge ↗

Alice, along with $N$ of her friends, visited a bakery. There, Alice initially bought $C$ cookies, and the $i$-th friend bought $A_i$ cookies. Alice is quite competitive, so she'll only be happy if: 1. **At least one** friend has **strictly less** cookies than her; and 2. **No other** friend has **equal** cookies to her. What's the minimum number of extra cookies Alice must buy, to ensure that

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