A8485 | Zoo
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
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.


C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted