|
||||||||||
Rectangle OutlineTime Limit: 20000/10000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 54 Accepted Submission(s): 10 Problem Description Given a series of rectangular obstacles, one per line. Rectangular obstacles can overlap each other. Each rectangular obstacle is specified as two points on 2D plane that specify the opposite corners of a rectangle. Your job is to calculate the outline of the coverage area of all rectangular. If the outline is made up of more than one closed polyline, print "Oops!". Otherwise, output the answer as follows: The first output point has the smallest X coordinate and then smallest Y coordinate. The second point has the same X coordinate with the first point. Then output other points in outline order. You can see more details in Sample. It's guarantee that every rectangle's sides are parallel to OX and OY. Any point on the 2D plane will not be the vertices of two rectangles at the same time. Input The first line contain a integer $T$(no more than 10), the following is $T$ test case, for each test case: The first line of each test case contains a integers n (1 $\le$ n $\le$ 100,000), number of rectangular obstacles. Each of the next n lines contains 4 integers x1, y1, x2, y2 (1 $\le$ x1 < x2 $\le$ 1,000,000,000, 1 $\le$ y1 < y2 $\le$ 1,000,000,000) specify a rectangular obstacles. It is guaranteed that the sum of all n does not exceed 700,000. Output Output the answer as described previously. Sample Input
Sample Output
Source | ||||||||||
|