Cops and Robbers

You are to simulate a game of Cops and Robbers. In this game, cops, robbers, and other citizens are represented as points in a two-dimensional plane. A citizen is said to be safe if it is within a triangle formed by three cops. A citizen is said to be robbed if it is not safe and is within a triangle formed by three robbers. A citizen is neither safe nor robbed if it satisfies neither of the above conditions. For purposes of this problem, a triangle consists of three points, and a point is within a triangle if it is inside or on the boundary of the triangle. In the following diagram, filled circles represent cops, filled squares represent robbers, and filled triangles represent citizens. Dashed lines indicate triangles formed by cops or robbers In this example, citizens A and B are safe, citizen C is robbed, and citizen D is neither. Given a set of cops and robbers and several citizen queries, efficiently determine whether each citizen is safe, robbed, or neither. Input The input consists of several data sets. The first line of each data set contains three non-negative integers c, r, and o: the number of cops, robbers, and other citizens, respectively. c, r, and o will each be at most 200. The next c lines contain the (x,y) coordinates of each cop, one per line. The next r lines contain the (x,y) coordinates of each robber, one per line. The next o linescontain the (x, y) coordinates of each other citizen, one per line. All coordinates are integers between -500 and 500 inclusive. A blank line follows each data set. Your program must stop processing input when it encounters a data set in which c, r, and o are all zero. Output Output for each data set begins with a line identifying the data set. For each other citizen in the data set, output the line Citizen at (x,y) is status. where (x,y) is the location of the citizen from the input and status is one of ‘safe’, ‘robbed’ or ‘neither’. Follow the format given in the Sample Output. Leave a blank line after the output from each data set. Warning: When a citizen is between two cops (resp. robbers) or match one of them, it must be considered ‘safe’ (resp. ‘robbed’) if there is a 3rd cop (resp. robber) anywhere so that they form a triangle.

2/2 Sample Input 332 00 10 0 0 10 20 20 20 0 0 20 55 15 15 331 00 10 0 0 10 20 20 20 0 0 20 40 40 000 Sample Output Data set 1: Citizen at (5,5) is safe. Citizen at (15,15) is robbed. Data set 2: Citizen at (40,40) is neither.