F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Triangles and Quadrangle

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 1411    Accepted Submission(s): 309


Problem Description
  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. You can also shifting, rotation and flipping one of the triangles to form the triangles to a quadrangle.
 

Input
  There are multiple test cases. The first line of input contains a single integer T denoting the number of test cases. (T <= 500)
  For each test case, there are 10 lines in total.
  The first 3*2 lines describe the two triangles. Each line with two integers denotes the coordinates of a point.
  The next 4 lines describe the quadrangle in clockwise order or counter-clockwise order.
  All coordinates are less than 15000 in absolute value.
 

Output
  For each test case, output ˇ°Yesˇ± if the given triangles can form a quadrangle without overlapping, ˇ°Noˇ± otherwise.
 

Sample 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
 

Sample Output
Case #1: Yes Case #2: No
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-25 04:56:38, Gzip enabled