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

8096번 - Monochromatic Triangles 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB22717813189.726%

문제

There are n points given in a space. There are no three points, such that they lie on the same straight line. Each pair of points is connected by a segment coloured red or black. Each triangle, whose sides have the same colour is called a monochromatic triangle. We are given a list of all red segments and we want to find the number of all monochromatic triangles.

Write a program that:

  • reads from the standard input the following data: the number of points, the number of red segments and their list,
  • finds the number of monochromatic triangles,
  • writes the result to the standard output.

입력

In the first line of the standard input there is one integer n, 3 ≤ n ≤ 1,000, which equals the number of points. In the second line there is one integer m, 0 ≤ m ≤ 250,000, which equals the number of red segments.

In each of the following m lines there are two integers p and k separated by a single space, 1 ≤ p < k ≤ n. They are numbers of vertices which are ends of a red segment.

출력

In the first line of the standard output there should be written one integer — the number of monochromatic triangles.

제한

예제 입력 1

6
9
1 2
2 3
2 5
1 4
1 6
3 4
4 5
5 6
3 6

예제 출력 1

2

힌트

출처

Olympiad > Polish Olympiad in Informatics > POI 1996/1997 > Stage 3 4번

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

출처

대학교 대회

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

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