The maximum distance

Problem Name:
The maximum distance
Site:HackerEarth
Links:
Tags:
Problem setters: