Get Time

   Problem Statement  

 Problem Statement for TrianglesContainOrigin

Problem Statement

    We have chosen a finite set of points in the plane. You are given their coordinates in the int[]s x and y: for each valid i, there is a point with coordinates (x[i],y[i]). We are interested in triangles with the following properties:
  • Each vertex of the triangle is one of our chosen points.
  • The point (0,0) lies inside the triangle.
Return the number of such triangles. Note that the constraints guarantee that there are no degenerate triangles and that the point (0,0) never lies on the boundary of a triangle.


Parameters:int[], int[]
Method signature:long count(int[] x, int[] y)
(be sure your method is public)


-x and y will contain between 3 and 2500 elements, inclusive.
-x and y will contain the same number of elements.
-Each element of x and y will be between -10,000 and 10,000, inclusive.
-No two points will be the same.
-No three points will be collinear.
-No point will be on the origin.
-There will be no two points P and Q such that P, Q, and the origin are collinear.


Returns: 1
There is exactly one possible triangle. It does contain the origin.
Returns: 2
There are four possible triangles. Two of them contain the origin. One is the triangle with vertices in (-1,1), (-1,-1), and (2,-1). The other is the triangle with vertices in (-1,-1), (1,2), and (2,-1).
Returns: 8
Returns: 256

This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2010, TopCoder, Inc. All rights reserved.

This problem was used for:
       Single Round Match 641 Round 1 - Division I, Level One