HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Geometry > problem:


50560 - Max Distance

Guest
• Review clarifications (1)

Section problems

• 50473 - Counting Circles Positions
• 50327 - Parallel Lines
• 50328 - How far away
• 50825 - Drawing Polygon
• 50508 - The Biggest Area
• 51034 - Area of 3 Shapes
• 50854 - Area of Triangle Revised
• 50669 - Area of an Irregular Polygon
• 50560 - Max Distance
• 50237 - Is it the same color?
• 50422 - Area and Perimeter of diffe...
• 50399 - Mobile Base Station
• 50397 - The Number of Points in a ...
• 50349 - Area of a Triangle
• 50348 - Area and Perimeter of a Rec...
• 50665 - Intersecting rectangles
• 50668 - Triangle

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Question by Ibrahim Mesecan.

Max distance

Shqip

Traveling salesman problem is a famous problem. According to the question, the salesman has to travel throgh n islands. And then in the end, he has to return back to his starting island.

Question:
Write a program that gets the x and y coordinates of n islands. Then, the program calculates the max Euclidean distance to travel between two cities according to the given order. The distances between the two consecutive islands are calculated. The last island is connected to the first island.

Input specification
You will be given an integer number (n). Then, in the following n lines, you will be given x and y coordinates of n islands where 1 ≤ n ≤ 40000 and coordinates -5000 ≤ (x and y) ≤ 5000.

Output specification
Show one number with 2 digits double precision, which is the max distance.

 Sample Input  
 4
 1 1
 2 2
 2 4
 1 4
 Sample Output   
 3


Explanation: According to the given order, the distances are:

  • between 1st and 2nd islands is 1.414
  • between 2nd and 3rd islands is 2.0
  • between 3rd and 4th islands is 1.0
  • between 4th and 1st islands is 3.0
And the distance between the 4th and 1st islands is the max distance.

Для отправки решений необходимо выполнить вход.

www.contester.ru