Sphere Online Judge

Computer geeks! Show off your skills and claim the job of your dreams! RecruitCoders.com

SPOJ Problem Set (classical)

9334. Point in tetrahedron

Problem code: TETRAHED

There're given 5 points in 3D coordinates (integers 0<=x,y,z<100). Their order is arbitrary. 4 of them are the vertices of a tetrahedron whose edges can be of different size. One is lying in this tetrahedron. Find its index (1-5) in the array of points.

Input

In the first line the number T (T<1000) of test cases.
Then for each test case 5 lines with the space separated x-, y- and z-coordinates of the 5 points.

Output

For each test case a line with the index of that point which is lying in the tetrahedron formed of the 4 other points.

Example

Input:
1
5 72 66
92 23 68
60 60 49
74 78 33
67 76 27 Output: 3

Added by:HWK
Date:2011-08-07
Time limit:10s
Source limit:50000B
Languages:All

hide comments
2011-10-03 01:35:11 ZiYuan
@HWK, my fault. I forgot to put "\n"'s to the output.
2011-10-02 18:28:25 HWK
@ZiYuan: You didn't blunder. Only add whitespace to the output. ;-)
I changed the problem description to clarify this.

Last edit: 2011-10-02 18:28:56
2011-10-02 18:28:25 ZiYuan
@HWK, could you tell me the test case where I blundered? The submission ID is 5762600 or 5762625. Thank you~

Last edit: 2011-10-02 10:32:37
2011-10-02 18:28:25 Nelson González Peñate
@HWK
Thanks
2011-10-02 18:28:25 HWK
@Nelson González Peñate (UCI-01):
E.g.
5 75 19
79 94 66
35 79 38
87 53 97
64 84 40
=> 3, not 5.
2011-10-02 18:28:25 Nelson González Peñate
@HWK
ID: 5588789
2011-10-02 18:28:25 HWK
@Nelson González Peñate (UCI-01): Which ID?
2011-10-02 18:28:25 Nelson González Peñate
@HWK
I got AC but:
Could you help me to understand why when I try to find the point where the sum of the distances to the other points is the smallest possible, I get WA?

Last edit: 2011-09-04 20:23:34
2011-10-02 18:28:25 Pranay
@HWK: Thanks :)
2011-10-02 18:28:25 HWK
@Pranay: e.g.
0 42 79
6 48 59
8 49 60
24 73 16
71 20 60
=> 3 not 5
SPOJ System © 2012 Sphere Research Labs | Projekty informatyczne i aplikacje na zamówienie. All Rights Reserved.