CF183B.Zoo

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

The Zoo in the Grid Kingdom is represented by an infinite grid. The Zoo has nn observation binoculars located at the OXOX axis. For each ii between 11 and nn , inclusive, there exists a single binocular located at the point with coordinates (i,0)(i,0) . There are mm flamingos in the Zoo, located at points with positive coordinates. The flamingos are currently sleeping and you can assume that they don't move.

In order to get a good view over the flamingos, each of the binoculars can be independently rotated to face any angle (not necessarily integer). Then, the binocular can be used to observe all flamingos that is located at the straight line passing through the binocular at the angle it is set. In other words, you can assign each binocular a direction corresponding to any straight line passing through the binocular, and the binocular will be able to see all flamingos located on that line.

Today, some kids from the prestigious Codeforces kindergarten went on a Field Study to the Zoo. Their teacher would like to set each binocular an angle to maximize the number of flamingos that can be seen by the binocular. The teacher is very interested in the sum of these values over all binoculars. Please help him find this sum.

输入格式

The first line contains two space-separated integers nn and mm (1<=n<=106,1<=m<=250)(1<=n<=10^{6},1<=m<=250) , denoting the number of binoculars and the number of flamingos, respectively.

Then mm lines follow, the ii -th line will contain two space-separated integers xix_{i} and yiy_{i} ( 1<=xi,yi<=1091<=x_{i},y_{i}<=10^{9} ), which means that the ii -th flamingo is located at point (xi,yi)(x_{i},y_{i}) .

All flamingos will be located at distinct points.

输出格式

Print a single integer denoting the maximum total number of flamingos that can be seen by all the binoculars.

输入输出样例

  • 输入#1

    5 5
    2 1
    4 1
    3 2
    4 3
    4 4
    

    输出#1

    11
    

说明/提示

This picture shows the answer to the example test case.

首页