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: Japanese Writing
Description Michael had visited ACM ICPC World Finals 2007 in Tokyo, Japan and became fascinated with Japanese writing. He decided to study hieroglyphs, but in order to check his knowledge he needs a piece of software that can verify correctness of his writing. This program takes a description of a correct shape of the hieroglyph, several Michael’s attempts to write it, and judges each attempt as correct or incorrect. In this problem hieroglyphs are represented as a collection of strokes, each stroke being a straight line on a Cartesian plane. The order of strokes is irrelevant for the hieroglyph shape, but the direction of each stroke is relevant. There are eight relevant directions: straight right, upper-right, straight up, upper-left, straight left, lower-left, straight down, and lower-right. Two writings are considered to represent the same shape if one-to-one correspondence can be established between the strokes and all the endpoints of the strokes, so that direction of strokes and relative positions of pairs of points are preserved. Preservation of relative positions is important for any pair of points, even if they are not connected with a stroke. However, relative positions are important only with respect to eight relevant directions described above. For example, here is a hieroglyph similar to Latin letter A with 5 endpoints connected with 3 strokes and several other correct writings of the same shape: Note, that intersections of strokes are not relevant. Here are several incorrect writings of the same shape: These writings are not correct for the following reasons: - Writing 5 has an extra point, so one-to-one correspondence between endpoints cannot be established.
- In writing 6 point
*d*is straight up from point*a*but it should be to the upper-right of it. - In writing 7 stroke
*d*−*e*goes in the wrong direction. - In writing 8 point
*c*is lower-right from point*a*but it should be straight to the right of it. - Writing 9 has an extra
*a*−*d*stroke, so one-to-one correspondence between strokes cannot be established.
Input The first line of the input file contains a single integer Each writing starts with a line with a single integer number m ≤ 100) — the number of strokes in _{i}i-th writing. It is followed by m lines that describe strokes for _{i}i-th writing. Each stroke is represented by a line with four integer numbers x, ^{a}_{ij}y, ^{a}_{ij}x, and ^{b}_{ij}y (−1000 ≤ ^{b}_{ij}x, ^{a}_{ij}y, ^{a}_{ij}x, ^{b}_{ij}y ≤ 1000) — coordinates of endpoints. ^{b}_{ij}x, ^{a}_{ij}y are coordinates of the beginning of ^{a}_{ij}j-th stroke and x, ^{b}_{ij}y are coordinates of the end of ^{b}_{ij}j-th stroke. The beginning and the end of the stroke are distinct points. Any two endpoints are connected by at most one stroke.Output Compare the shapes of writings from 2nd to Sample Input 9 3 0 0 10 20 10 20 20 0 5 10 15 10 3 0 0 10 20 10 20 20 0 2 10 13 10 3 0 0 10 15 10 15 20 0 5 10 15 10 3 8 10 12 10 0 0 10 20 10 20 14 0 3 0 0 8 20 12 20 20 0 5 10 15 10 3 0 0 10 20 10 20 20 0 0 10 15 10 3 0 0 10 20 10 20 20 0 15 10 5 10 3 2 4 10 20 10 20 20 0 5 10 15 10 4 0 0 10 20 0 0 5 10 10 20 20 0 5 10 15 10 Sample Output CORRECT CORRECT CORRECT INCORRECT INCORRECT INCORRECT INCORRECT INCORRECT Source |

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

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

Any problem, Please Contact Administrator