Airline Hub
InterviewTime limit1sMemory limit128 MB
Given up to 1000 airports by latitude and longitude, pick the one minimizing the largest great-circle distance to any other airport, breaking ties by earliest input order.
- Level
Medium4 of 10
- Topics
- Geometry, Brute force, Math, Implementation
- Solved
- No attempts yet
Problem
World Wide Flyer has landing rights at several airports around the world. They want to place their central hub at one of these airports — the airport that minimizes the maximum direct flying distance from the hub to every other airport.
Treat the Earth as a perfect sphere and take the direct flying distance between two airports to be the great-circle distance (the shortest distance along the surface). Because the sphere's radius is a positive factor common to every distance, the best hub is the airport that minimizes the largest central angle to the other airports, and the choice does not depend on the radius that is used.
Input
The first line contains an integer (), the number of airports. Each of the next lines contains two real numbers: the latitude (between and degrees) and the longitude (between and degrees) of an airport.
Output
Print a single line with the latitude and longitude of the airport that best serves as the hub, each rounded to exactly two decimal places and separated by a single space. If several airports achieve the minimum possible maximum distance, print the one that appears earliest in the input.