Triangle RevisitedProblem code: AD4 |
All submissions for this problem are available.
Cody is busy in making triangles, so he has got another problem here, there are a set of given integral points on a 2-D plane. Johnny needs to find out how many triangles can be drawn using the set of given points.
Input
First line of input consists of t (1<=t<=15) test cases, then t test cases follows 1st line consisting of n , the no. of the points (1<=n<=1000), and next n lines consisting of two integers, the x and the y co-ordinate of each point All coordinates have absolute values not larger than 10000
Output
The output must contain n lines of output, with 1 integer in each line. The integer is the number of possible triangles that could be formed using the set of all the given points.
Example
Input: 2 5 -1 -1 1 -1 0 -2 -2 -2 0 0 4 -1 -2 1 0 -1 1 0 -1 Output: 8 3
| Date: | 2010-02-28 |
| Time limit: | 1s |
| Source limit: | 50000 |
| Languages: | C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C# C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp SCALA HASK ERL CAML CLPS PRLG WSPC BF ICK JS |
Comments

Fetching successful submissions

Please check your test case
Please check your test case as for n=5 and for these given points ans = 10 .. check plz
Please post all your doubts
Please post all your doubts here or mail it to algothika.algochallenge@gmail.com
ALGOTHIKA ORGANIZER
Nirley Gupta
yes the answer for n=5 should
yes the answer for n=5 should be 9 and not 8.
sorry for inconvenience caused.
Join us also on
Join us also on facebook
ALGOTHIKA
Are the test cases corrected
Are the test cases corrected accordingly?
and it should be 10 for the sample case and not 9
proof: naming the points A,B,C,D,E
ABC,ABD,ABE
ACD,ACE
ADE
BCD,BCE
BDE
CDE
Reply ASAP
the sample output is correct,
the sample output is correct, there are 3 points collinear for n=5 input,
which will not form a triangle, so total no. of triangles is 9 not 10.
so as u are assuming the points to be A,B,C,D,E there will be no triangle named ADE
I am also reviewing the original output test cases, for any fault!
@admin can you explain how it
@admin can you explain how it is 8. I am getting 9 for test case 2 i.e n=5
have you reviewed your
have you reviewed your original test cases??
The test data for this
The test data for this problem is wrong!!! I m sure my first submission is right!!
@Admin: Can you please check this!!
i have reviewed all the test
i have reviewed all the test cases!
the output are correct corresponding to the inputs
there is still some problem persisting in ur code
plz figure it out!
@Admin: Thanks!! Figured it
@Admin: Thanks!! Figured it out!!!
what should be the answer for
what should be the answer for first case 8 or 9 ??
i m getting 8 and i m sure dat i m correct.
admin please check the test
admin please check the test cases....might there is some discrepancy..
@ankit There is no problem
@ankit
There is no problem with test cases...
as you can see, we have receive quite successful submissions and test cases have been reviewed thoroughly
@khyatigupta the answer is 9
@khyatigupta
the answer is 9 not 8, plz check your algorithm
@ankit
i am sure i dont need to review any test case again
admin.algothika and
admin.algothika and Nirley
for 1st testcase what is the output 8 or 9
i am getting 9
@Arpit Itz 9........
@Arpit
Itz 9........