← All problemsSign in

Ball Game

CodeChefRating 1736Open on judge ↗

$N$ balls are placed at **distinct** coordinates on the $X-$axis. The initial coordinate of the $i^{th}$ ball is given as $A_i \ (A_i \gt 0)$. A hole is present at the origin. The $i^{th}$ ball moves towards the hole with a speed of $B_i$ units per second. If multiple balls collide **before** reaching the hole, they merge into one ball, taking the maximum speed of the initial balls. Determine

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