시간 제한메모리 제한제출정답맞힌 사람정답 비율
7 초 1024 MB319521.739%

문제

The king of Nlogonia has conquered many lands throughout his life, and now that his son has come of age, the king wants to share his possessions with him.

Nlogonia has N ancient towers that can be seen as points in the Cartesian plane. The king decided that his son must choose four of those towers. Then the son must build a wall connecting the towers, so as to form a (simple but not necessarily convex) quadrilateral with the towers as vertices. The land surrounded by the wall will be owned by the son. Since the king does not want people making fun of his son for not having enough land, the area of the quadrilateral must be greater than or equal to a given value S.

The son is eager to choose his portion of the land, but the king wants to know beforehand in how many different ways this can be done. The picture below shows an example with N = 4 towers. In this case, there are two different quadrilaterals with an area of at least S = 2.

입력

The first line contains two integers S (1 ≤ S ≤ 1018) and N (4 ≤ N ≤ 400), indicating respectively the minimum area and the number of ancient towers. Each of the next N lines describes a tower with two integers X and Y (0 ≤ X, Y ≤ 109), denoting the coordinates of the tower. No two towers have the same location, and no three of them are collinear.

출력

Output a single line with an integer indicating the number of different simple quadrilaterals having towers as vertices and area at least S. A quadrilateral is simple if non-contiguous edges do not intersect. Two quadrilaterals are considered different if they have different vertices or different edges.

예제 입력 1

2 4
1 2
3 4
3 3
4 1

예제 출력 1

2

예제 입력 2

1 4
1 2
3 4
3 3
4 1

예제 출력 2

3

예제 입력 3

4 5
1 1
3 3
3 0
0 1
1 0

예제 출력 3

3

예제 입력 4

1 4
0 0
1000 0
0 1000
1000 1000

예제 출력 4

1

출처

ICPC > Regionals > Latin America > Latin America Regional Contests > Latin America Regional Contests 2021 A번

  • 문제를 만든 사람: Giovanna Kobus Conrado