아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Good Triplets

시간 제한1초메모리 제한1024 MB

요약
원 위의 정수 위치에 놓인 점들이 주어질 때, 중심을 엄격히 내부에 포함하는 삼각형을 이루는 세 점의 개수를 센다.
난이도

보통10점 중 7점

유형
수학, 기하, 조합론
정답자
아직 제출이 없습니다

문제

Andrew is a very curious student who drew a circle with the center at (0, 0) and an integer circumference of C ≥ 3. The location of a point on the circle is the counter-clockwise arc length from the right-most point of the circle.

Andrew drew N ≥ 3 points at integer locations. In particular, the ith point is drawn at location Pi (0 ≤ Pi ≤ C − 1). It is possible for Andrew to draw multiple points at the same location.

A good triplet is defined as a triplet (a, b, c) that satisfies the following conditions:

  • 1 ≤ a < b < c ≤ N.
  • The origin (0, 0) lies strictly inside the triangle with vertices at Pa, Pb, and Pc. In particular, the origin is not on the triangle’s perimeter.

Lastly, two triplets (a, b, c) and (a', b', c') are distinct if a ≠ a', b ≠ b', or c ≠ c'.

Andrew, being a curious student, wants to know the number of distinct good triplets. Please help him determine this number.

입력

The first line contains the integers N and C, separated by one space.

The second line contains N space-separated integers. The ith integer is Pi (0 ≤ Pi ≤ C − 1).

출력

Output the number of distinct good triplets.

예제1

  1. 예제 1

    입력
    8 10
    0 2 5 5 6 9 0 0
    
    예상 출력
    6