406793: GYM102556 I Riana and the Illuminous Triangles

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. Riana and the Illuminous Trianglestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

Riana always wanted to join the secret order of the ProgVar. Most people doubt its existence, believing it to be just a myth propagated by paranoid conspiracy theorists. However, some, including Riana, know the truth: ProgVar is an immensely influential organization working behind the scenes to control the world at large.

The all-knowing ProgVar, of course, is aware of her intent. One day, she received an initiation parchment. The parchment contains a geometric graph of $$$n$$$ points, no three of which are collinear. Riana knows that ProgVar is obsessed with triangles, and that she may form a triangle from any three of the $$$n$$$ points.

To demonstrate her commitment to joining the order, she must count how many ways there are of forming two triangles such that one triangle lies entirely within the other. In particular, these two triangles must not share a vertex. Two ways of forming triangles are considered distinct if there is a point that is used as a triangle vertex in one way but not in the other way.

Riana, of course, is a capable follower, and she sent her answers to the order in less than two seconds. ProgVar, busy with more important world affairs, has outsourced the task of checking her answers to you. How many such ways of forming two triangles are there?

Input

The first line contains the number of points $$$n \leq 300$$$.

The next $$$n$$$ lines each contains two integers $$$x$$$ and $$$y$$$, where the $$$i$$$th line denotes that the $$$i$$$th point is $$$(x, y)$$$.

The absolute values of the coordinates of each point are guaranteed not to exceed $$$10^4$$$.

Output

Print how many such ways there are of forming two triangles that satisfy the problem.

Note that the answer may exceed $$$10^{10}$$$.

ExamplesInput
7
1 1
1 -1
-1 -1
-1 1
4 -2
-4 -2
0 3
Output
4
Input
8
3 0
2 2
0 3
-2 2
-3 0
-2 -2
0 -3
2 -2
Output
0
Input
15
-691 -45
-5993 -7095
4994 -4998
6585 6740
-3726 -241
-8489 -1030
-3261 3284
-2295 -2242
5985 -5838
-7843 -8290
-6834 278
3974 2002
-9268 6063
5698 6962
5664 -6676
Output
307
Note
For the first test case, one may take the three outermost points to form the outer triangle. The four remaining points lie inside this triangle. One may choose three of these four points to form the inner triangle. There are four ways to make such a choice, giving four valid ways of forming two triangles.

It may also be shown that there are no other pairs of triangles that satisfy the problem conditions. Therefore, the answer for the first test case is $$$4$$$.

加入题单

上一题 下一题 算法标签: