本篇文章主要介绍了"1037 - Air Traffic Control"，主要涉及到1037 - Air Traffic Control方面的内容，对于1037 - Air Traffic Control感兴趣的同学可以参考一下。
In order to avoid midair collisions, most commercial flights are monitored by ground-based air traffic control centers that track their position using radar. For this problem, you will be given information on a
set of airplanes and a set of control centers, and you must compute how monitoring of the airplanes is distributed among the control centers. The position of each airplane is represented by a unique (x, y)coordinate
pair. For the purpose of this problem, the height (altitude) of the airplanes can be ignored.
The number of airplanes that can be monitored by a given control center varies from time to time due to changes in staff and equipment. At any given time, each control center monitors as many planes as it can, choosing
the airplanes to be monitored according to the following priorities:
(1)it will prefer to monitor planes that are closer to the control center rather than ones that are farther away;(2)if two airplanes are equally distant from the center and the center can monitor only one of them, it will choose the one that is farther to the north (positive y-axis);(3)if two airplanes are equally distant and have the same y-coordinate, the center will give preference to the airplane that is farther to the east (positive x-axis).
At any given moment, each control center has a circular ``span of control" whose radius is the distance to the farthest airplane being monitored by the control center. All airplanes inside the span of control are
monitored by the control center. Airplanes on the boundary of the span of control may or may not be monitored by the control center, depending on its capacity and on the priorities listed above.
You will not be given the positions of the control centers. Instead, for each control center, you will be given the number of airplanes that it is currently monitoring, and two points that are on the boundary of
its current span of control. With this information, you can compute the position of the control center and decide which airplanes it is monitoring. If the data is consistent with more than one possible span of control, you should choose the span that includes
the airplane that is farthest to the north, breaking ties by choosing the airplane that is farthest to the north then to the east.
The figure below, which shows four airplanes and two control centers, illustrates the problem. Each control center is represented by a circular span of control and by two points on the boundary of this span, labeled
A and B. P1, P2, P3, and P4 label the four airplanes. In this example, airplanes P1 and P4 are each being monitored by a single control center, airplane P3 is being monitored by two control centers, and airplane P2 is not being monitored by either control
The input consists of several trial data sets. The first line of input in each trial data set contains two integers NP ( 0
< NP < 100) and NC ( 0
< NC < 10), which represent the number of airplanes and the number of control centers, respectively. Each of the next NP lines
contains two floating-point numbers that represent the (x, y) coordinates of one airplane. Each of the next NC lines
describes one control center. Each contains an integer between 0 and NP (inclusive) indicating the number of airplanes monitored
by the control center, followed by two pairs of floating point numbers that represent the (x, y) coordinates of two
points on the boundary of its span of control (neither of which is the position of an airplane). If two distances differ by less than 0.00001, you should treat them as the same distance.
The last data set is followed by a line containing two zeros.
For each trial, compute the number of airplanes that are monitored by zero control centers, the number of airplanes that are monitored by one control center, and so on up to the number of airplanes that are monitored
by NC control centers. Print the trial number followed by a sequence of NC +
1 integers, where thei-th integer in the sequence represents the number
of airplanes that are monitored by i - 1 control centers. If data for one of the control centers is inconsistent, print `Impossible'
instead of the sequence of integers for that trial. Use the format shown in the example output, and print a blank line after each trial.
2 1.0 2.0 2.0 0.0
2 2.0 2.0 4.0 2.0
0 -1.0 0.0 1.0 0.0
Trial 1: 1 2 1
Trial 2: Impossible
using namespace std;
const double eps=1e-5;
coor operator -(coor a,coor b)
bool cmp(coor a,coor b)
return a.y>b.y+eps || (a.y>b.y-eps && a.x>b.x);
double len(coor a)
return sqrt(a.x*a.x + a.y*a.y);
bool cross(coor A,coor B,coor C,coor &O)
void work(coor A,coor B,coor C)
if(in>m || in+on<m)
else if(len(O-P[i])<Tr+eps && on)
if(r<0||Tr<r-eps||(Tr<r+eps && check()))
scanf("%d %lf %lf %lf %lf",&m,&A.x,&A.y,&B.x,&B.y);
printf("Trial %d: ",++C);