Global Roaming
Time limit1sMemory limit128 MB
Given a satellite position and a list of ground locations on a sphere, decide which locations have the satellite above their horizon.
- Level
Medium4 of 10
- Topics
- Geometry, Math, Implementation
- Solved
- No attempts yet
Problem
A great deal of today's mobile communication relies on having a direct line of sight to a satellite. For communication providers it is therefore crucial to know where their services are available.
You must identify the locations that have a direct line of sight to a given satellite; that is, the satellite must be above the horizon. To simplify the computation, assume that the earth is a perfect sphere with a radius of km (mountains will be added next year...). The satellite is treated as a point-like object above the earth's surface.
Input
The input consists of several test cases. The first line of each test case contains the number of locations to be checked, followed by the position of the satellite: its latitude, its longitude (both in degrees), and its height (in km) above the earth's surface.
Each of the following lines describes one location on the earth's surface: the location's label (a string of fewer than printable ASCII characters containing no whitespace) followed by its latitude and longitude (both in degrees).
The input is terminated by a line with .
Output
For each test case, first print a line of the form Test case k:, where is the test-case number starting from . Then print the labels of the locations from which the satellite is visible, one per line, in the same order as they appear in the input.
Separate two consecutive test cases with a single blank line.