Save Ned
CodeChefOpen on judge ↗
Goblin has trapped Ned and Spider Man wants to save him. Goblin won't go easy on Spider Man and has given him this challenge to solve. There are $N$ pumpkin bombs placed on a table. The $i^{th}$ bomb has a value $A_i$ written on it and the cost of incrementing/decrementing this value by $1$ unit is $B_i$. Spider Man was asked to make the **values on all bombs equal** by performing increment/decr
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