Logo
(追記) (追記ここまで)

21622번 - Triangles and a Circle 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB22121168.750%

문제

You are given $n$ distinct points on a circle of length $L$.

You need to find the number of triangles with vertices in these points that contain the center of the circle inside, or on their border.

입력

The first line of input contains two integers $n$ and $L$ (3ドル \leq n \leq 300,000円,ドル $n \leq L \leq 10^9$).

Let's choose any point on the circle and call it $S$. Then any point $A$ on the circle can be encoded as $x,ドル 0ドル \le x < L$: clockwise distance from $S$ to $A$. We will call this number a coordinate of $A$.

The second line contains $n$ distinct integers $x_1, x_2, \ldots, x_n$: coordinates of the given points on the circle (0ドル \leq x_i < L$).

출력

Print one integer: the number of triangles with vertices in the given points, that contain the center of the circle inside or on their border.

제한

예제 입력 1

3 10
0 1 2

예제 출력 1

0

예제 입력 2

10 10
0 1 2 3 4 5 6 7 8 9

예제 출력 2

60

힌트

출처

Olympiad > Russian Olympiad in Informatics > Russia High School Programming Contest > Russia High School Programming Contest 2020 B번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /