Robert Hood
Time limit1sMemory limit256 MB
Given C points on a plane, compute the squared distance between the farthest pair of points.
- Level
Medium6 of 10
- Topics
- Geometry, Sorting, Two pointers
- Solved
- No attempts yet
Problem
Robert Hood is Robin Hood's younger brother. He practices archery because he wants to become a legend like his brother.
This time the archery contest held in Nottingham follows different rules from modern archery. In modern archery the person with the higher score wins. In the Nottingham contest the winner is the person with the largest maximum distance between two of their arrows on the target.
Robert Hood shot arrows and every one of them hit the target. The target is a two dimensional plane and each arrow is a point. Given the coordinates of the arrows, write a program that finds the square of the distance between the two farthest arrows.
Input
The first line contains the number of arrows Robert Hood shot, (). Each of the next lines contains the coordinates and of one arrow, separated by a space. The coordinates are integers and their absolute values do not exceed . Several arrows can land on the same spot.
Output
Print the square of the distance between the two farthest arrows. The coordinates are integers, so this value is always an integer. Print it without a decimal point.