Triangles
Time limit1.2sMemory limit1024 MB
Count triangles formed by n points, no three collinear, that contain at least one other point strictly inside.
- Level
Medium6 of 10
- Topics
- Geometry, Combinatorics, Sorting, Math
- Solved
- No attempts yet
Problem
A triangle is a simple polygon having exactly three distinct corners that are not collinear. For any set of points in the plane, a triangle is said to have a conflict with if there is at least one point contained both in and in the interior of the triangle, excluding its boundary, simultaneously.
Now, the set is given to be a set of points in the plane, no three of which are collinear, and let be the set of all triangles whose corners are chosen from the set . How many of those in have a conflict with ?
Write a program that outputs the number of triangles in that have a conflict with .
Input
Your program is to read from standard input. The input starts with a line containing an integer (), where is the number of points in the set . Each of the following lines consists of two integers, each between and , representing the coordinates of each point in the set . It is guaranteed that no three points in the set are collinear.
Output
Your program is to write to standard output. Print exactly one line. The line should contain an integer that represents the number of triangles whose corners are chosen from the set and that have a conflict with the set .