300974: CF183B. Zoo

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Zoo

题意翻译

网格王国中的动物园由一个无限的网格表示。动物园有$n$个位于$OX$轴的观察双筒望远镜。对于$1$到$n$之间的每一个$i$,包括在内,都存在一个位于坐标为$(i,0)$的点上的双筒望远镜。动物园内有$m$只火烈鸟,位于坐标为正数的点上。这些火烈鸟目前正在睡觉,你可以假设它们不会移动。 为了在火烈鸟上空获得良好的视野,每个双筒望远镜都可以独立旋转,面向任何角度(不一定是整数)。然后,双筒望远镜可以用来观察位于通过双筒望远镜的直线上的所有火烈鸟,而这个角度是它设定的。换句话说,你可以给每个双筒望远镜分配一个方向,对应于通过双筒望远镜的任何一条直线,双筒望远镜就能看到位于这条直线上的所有火烈鸟。 今天,著名的Codeforces幼儿园的一些孩子去动物园进行实地考察。他们的老师想给每个双筒望远镜设置一个角度,以使双筒望远镜能看到的火烈鸟数量最大化。老师对所有双筒望远镜的这些数值之和非常感兴趣。请帮助他找到这个总和。

题目描述

The Zoo in the Grid Kingdom is represented by an infinite grid. The Zoo has $ n $ observation binoculars located at the $ OX $ axis. For each $ i $ between $ 1 $ and $ n $ , inclusive, there exists a single binocular located at the point with coordinates $ (i,0) $ . There are $ m $ 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 $ n $ and $ m $ $ (1<=n<=10^{6},1<=m<=250) $ , denoting the number of binoculars and the number of flamingos, respectively. Then $ m $ lines follow, the $ i $ -th line will contain two space-separated integers $ x_{i} $ and $ y_{i} $ ( $ 1<=x_{i},y_{i}<=10^{9} $ ), which means that the $ i $ -th flamingo is located at point $ (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. ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF183B/757dceb4f771edfe053738d9268c557dc412c79e.png)

Input

题意翻译

网格王国中的动物园由一个无限的网格表示。动物园有$n$个位于$OX$轴的观察双筒望远镜。对于$1$到$n$之间的每一个$i$,包括在内,都存在一个位于坐标为$(i,0)$的点上的双筒望远镜。动物园内有$m$只火烈鸟,位于坐标为正数的点上。这些火烈鸟目前正在睡觉,你可以假设它们不会移动。 为了在火烈鸟上空获得良好的视野,每个双筒望远镜都可以独立旋转,面向任何角度(不一定是整数)。然后,双筒望远镜可以用来观察位于通过双筒望远镜的直线上的所有火烈鸟,而这个角度是它设定的。换句话说,你可以给每个双筒望远镜分配一个方向,对应于通过双筒望远镜的任何一条直线,双筒望远镜就能看到位于这条直线上的所有火烈鸟。 今天,著名的Codeforces幼儿园的一些孩子去动物园进行实地考察。他们的老师想给每个双筒望远镜设置一个角度,以使双筒望远镜能看到的火烈鸟数量最大化。老师对所有双筒望远镜的这些数值之和非常感兴趣。请帮助他找到这个总和。

加入题单

上一题 下一题 算法标签: