Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Observe that if you ignore collisions, the resultant positions of robots after d seconds would be the same.
After d seconds, sort the ending positions and use prefix sum to calculate the distance sum.