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

3D Camera

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


Problem Description
Long long ago, there was a world of triangles. A smart guy in that world invented a camera, whose viewfinder was a
triangle. The camera's visual range could be represented by three RAYS. As the figure shows, the camera's visual
range could be represented by three rays OA, OB, OC. Note that the visual range is INFINITE.


Now, we have a camera with known visual range and a triangle DEF in the space. The inventor wants to know if the
camera can see the triangle, in other words, if there is at least one point of the triangle strict in the visual range.
 

Input
The input consists of multiple test cases. The first line of input contains an integer T, which is the number of test cases.

The first line of each test case contains 12 integers: Ox, Oy, Oz, Ax, Ay, Az, Bx, By, Bz, Cx, Cy, Cz. The second line
contains 9 integers: Dx, Dy, Dz, Ex, Ey, Ez, Fx, Fy, Fz.
All the integers in a line are separated by a whitespace.

[Technical Specification]
T is an integer, and T <= 1000.
The input guaranteed that if you look from O, three points ABC are always arranged counterclockwise.
All integers EXCEPT T is in the range of [-100,100].
We guarantee the camera and the triangle are not degenerate.
 

Output
For each test case, display a single line contains the result, "YES" for visible, "NO" for not visible.
 

Sample Input
2 90 -14 -17 71 98 94 69 59 -16 -52 68 13 -69 -96 43 81 -67 -79 66 -51 -53 0 0 1 0 0 0 1 0 0 0 1 0 0 0 -5 0 0 -6 1 1 -6
 

Sample Output
NO YES
 

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-11-22 18:45:45, Gzip enabled