TQ - Triangles and Quadrangle
Little Yuan is two years old and she is learning about some triangles and quadrangles. She is such a smart girl that she soon realizes two triangles can form a quadrangle without overlapping each other. She picks up a lot of triangles and uses them to form some quadrangles. Unfortunately, she is not good at this kind of jigsaw game and makes some mistakes.
As her brother, you are curious about whether she has made a mistake when forming two triangles into a quadrangle. You are thinking about to write a program to determine it.
Notice that the quadrangle in this problem is defined as a simple polygon with four vertexes. And you may also assume that all triangles and quadrangle have positive area.
Note that two graphs are considered as the same if and only if they can overlap completely by shifting, rotation and flipping.
Input
There are multiple test cases. The first line of input contains a single integer T denoting the number of test cases. (T < 1000)
For each test case, there are 10 lines in total.The first 3*2 lines describe the two triangles. Each line with two numbers denotes the coordinates of a point.The next 4 lines describe the quadrangle in clockwise order or counter-clockwise order.
All coordinates are integers and less than 15000 in absolute value.
Output
For each test case, output Yes if the given triangles can form the given quadrangle without overlapping, No otherwise. See the example for more output format details.
Example
Input: 2 0 0 0 1 1 0 0 0 0 1 1 0 -1 0 0 0 1 0 0 1 0 0 -1 1 1 0 0 0 0 1 1 0 -1 0 0 0 1 0 0 1 Output: Case #1: Yes Case #2: No
This problem is first solved by team FreeJourney (Wuhan University) at 83 minutes after the onsite contest starts.
The test set of this problem is not the same as that of the onsite contest.
hide comments
Alex Anderson:
2011-11-11 06:11:31
It is not as poorly stated as you claim. Just read the problem statement again. |
|
Don Dodson:
2011-11-11 06:11:31
The problem is very poorly stated. Should we just output "Yes" or "No" as the problem statement indicates, or should we also output "Case #1:" as the example suggests? Do we output "Yes" if the triangles can form the quadrangle given in the input, or if it can form "a" (or any?) quadrangle? |
Added by: | Fudan University Problem Setters |
Date: | 2011-10-10 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | ACM/ICPC Regional Contest, Shanghai 2011; Problem Setter: g201513 |