|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|1 초||128 MB||1||1||1||100.000%|
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:
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.
6 9 1 2 2 3 2 5 1 4 1 6 3 4 4 5 5 6 3 6