Halloween Ghouls
CodeChefOpen on judge ↗
In the haunted chocolate town of $N$ houses, each guarded by spooky candies represented by the array $Ai$. Jack, the daring trick-or-treater, must summon $K$ little ghouls to the town. His challenge is to guarantee that the happiness of these ghostly children surpasses or equals the haunted threshold, $H$. The happiness of the children is determined by the following wicked formula: Happiness =
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