Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|

Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |

Language: Geometric Shapes
Description While creating a customer logo, ACM uses graphical utilities to draw a picture that can later be cut into special fluorescent materials. To ensure proper processing, the shapes in the picture cannot intersect. However, some logos contain such intersecting shapes. It is necessary to detect them and decide how to change the picture. Given a set of geometric shapes, you are to determine all of their intersections. Only outlines are considered, if a shape is completely inside another one, it is not counted as an intersection. Input Input contains several pictures. Each picture describes at most 26 shapes, each specified on a separate line. The line begins with an uppercase letter that uniquely identifies the shape inside the corresponding picture. Then there is a kind of the shape and two or more points, everything separated by at least one space. Possible shape kinds are: • square: Followed by two distinct points giving the opposite corners of the square. All points are always given as two integer coordinates X and Y separated with a comma and enclosed in parentheses. You may assume that |X|, |Y | ≤ 10000. The picture description is terminated by a line containing a single dash (“-”). After the last picture, there is a line with one dot (“.”). Output For each picture, output one line for each of the shapes, sorted alphabetically by its identifier (X). The line must be one of the following: • “X has no intersections”, if X does not intersect with any other shapes. Please note that there is an additional comma for more than two intersections. A, B, etc. are all intersecting shapes, sorted alphabetically. Print one empty line after each picture, including the last one. Sample Input A square (1,2) (3,2) F line (1,3) (4,4) W triangle (3,5) (5,5) (4,3) X triangle (7,2) (7,4) (5,3) S polygon 6 (9,3) (10,3) (10,4) (8,4) (8,1) (10,2) B rectangle (3,3) (7,5) (8,3) - B square (1,1) (2,2) A square (3,3) (4,4) - . Sample Output A has no intersections B intersects with S, W, and X F intersects with W S intersects with B W intersects with B and F X intersects with B A has no intersections B has no intersections Source |

[Submit] [Go Back] [Status] [Discuss]

All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di

Any problem, Please Contact Administrator