This is the answer for problem H of IEEEXtreme 5.0, I did not attempt this one on the competition and now feel bad about it! Nevertheless it can have defects still. If you find any please let me know. I haven’t completely finished it as a submission, so please make sure of these before you use the source.
1. Make sure you make a “ball” object for every ball.
2. Make sure you push_back those balls on to the list in a sorted manner from South most(position=0) ball to the North most ball; it only checks the nearest balls for collisions.
PS: All of the balls’ positions are updated even though the question asks for only a specified ball’s position.