#P8398. [CCC 2022 S4] Good Triplets
[CCC 2022 S4] Good Triplets
Problem Description
is a very curious student. One day, he drew a circle on paper with its center at . Let the circumference be . The coordinates of each point on the circle are:

Now marks points on the circle. The -th point is placed at . may place multiple points at the same position.
A good triangle is defined as:
- .
- The origin lies strictly inside the triangle whose vertices are at , , and . Note in particular that the origin is not on the boundary of the triangle.
asks you how many good triangles there are.
Input Format
The first line contains two integers , representing the number of points and the circumference of the circle.
The next line contains integers. Their meaning is described above.
Output Format
Output an integer , indicating that there are good triangles.
8 10
0 2 5 5 6 9 0 0
6
Hint
Explanation for Sample :
drew the following figure:

The origin lies strictly inside the triangle with vertices at , , and , so is a good triangle. The other five good triplets are , , , , and .
For of the testdata: , .
For another of the testdata: , .
For of the testdata: , , and all point positions are pairwise distinct.
For of the testdata: , .
Translated by ChatGPT 5