Radar Scopes

No attempts yetTime limit1sMemory limit128 MB

Problem

You have joined a team of software designers building a new air-traffic control system. One of its functions is to automatically verify that the monitored aircraft's instruments are working, and to alert controllers to aircraft that are endangered, newly aloft, or possibly downed. You are to write a prototype of this function.

Your program is given a series of scenarios, each consisting of two radar sweeps. Each sweep detects between $0$ and $100$ airplanes. Every time a sweep encounters a plane, the data-acquisition system captures an azimuth reading and a distance (in miles) from the radar, and also retrieves from the plane a squawk number and a ground speed (in miles/hour, an airspeed with wind corrections). Based on the two sweeps you must decide, for every plane in the radar's domain, whether a warning is required.

Assume a radar range (radius of coverage) of $10$ miles and instantaneous sweeps occurring $5$ seconds apart, so the time between sweeps is $\Delta t = 5/3600$ hours.

An azimuth $\theta$ and distance $d$ can be turned into plane coordinates (only relative positions matter for distances): let $x = d\sin\theta$ and $y = d\cos\theta$.

Based on the radar and plane information, issue the following warnings.

  • equipment warning: For a plane present in both sweeps, let $\bar g = (g_1+g_2)/2$ be the average of the plane's two indicated airspeeds and let $v$ be the airspeed measured from the radar sweeps (the distance between the plane's two positions divided by $\Delta t$). Warn if $\bar g$ is not within $10%$ of $v$, i.e. if $|\bar g - v| > 0.10,v$.
  • new intrusion / new aloft: Consider a plane seen in the second sweep but absent from the first, now at distance $d_2$. The minimum distance it must travel to come onto the scope (shortest path) is $10 - d_2$ miles. With a $10%$ margin it could have covered $1.10,g_2,\Delta t$ miles between the sweeps. If that is at least $10 - d_2$, the plane could have flown in from outside, so issue a new intrusion warning; otherwise it must have just taken off inside the scope, so issue a new aloft warning.
  • domain exited / domain loss: Consider a plane seen in the first sweep but not in the second, at distance $d_1$. The minimum distance to leave the scope is $10 - d_1$ miles. If $1.10,g_1,\Delta t \ge 10 - d_1$, the plane could have left the range, so issue a domain exited warning; otherwise it must have landed or crashed within the domain, so issue a domain loss warning.

Input

The first line of each scenario contains an integer $N_1$ ($0 \le N_1 \le 100$), the number of planes detected in the first sweep. The next $N_1$ lines each describe exactly one plane detected in sweep 1. Each description contains a squawk number, an azimuth, a distance, and a ground speed. The squawk number is an integer of 1 to 5 digits; the azimuth, distance, and ground speed are real numbers in the format XXX.XXX with leading and trailing zeroes as needed to fill all 6 places.

  • squawk number ($0 < S < 32767$): a globally unique integer identifying each plane, used to match planes between sweeps 1 and 2.
  • azimuth ($000.000 \le A \le 359.999$): the angle in degrees from North, sweeping toward the East. So East is $90$ degrees, South is $180$, and West is $270$.
  • distance ($000.000 \le D \le 010.000$): the distance from the radar to the plane (extra distance due to altitude has already been removed by the radar's sensing logic).
  • ground speed ($000.000 \le G \le 999.999$): the speed at which the plane is moving (in any direction) relative to the radar.

Immediately after the sweep-1 descriptions is a line with an integer $N_2$ ($0 \le N_2 \le 100$), the number of planes detected in the second sweep, followed by $N_2$ lines describing the sweep-2 planes in the same format.

The next scenario, if any, begins with $N_1$ on the following line. Read and process scenarios until end-of-file.

Output

For each scenario, first print Scenario # X, where $X$ is the scenario number, starting at $1$ for the first scenario and increasing by $1$.

Then, for each plane requiring a warning, print exactly one report line. Sort the report lines in ascending order of squawk number. On each line, write the squawk number right-justified in columns 1 to 5, then starting in column 6 one of the following warning strings (print the leading blanks and dashes exactly as shown):

  • " -- equipment warning"
  • " -- new intrusion"
  • " -- new aloft"
  • " -- domain exited"
  • " -- domain loss"

Print nothing for planes that require no warning.

Separate two consecutive scenarios with a single blank line (there is no extra blank line after the final scenario).