CF183B.Zoo

普及+/提高

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

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.

网格王国的动物园由一个无限大的网格表示。动物园中有 nn 个观鸟双筒望远镜,均位于 OXOX 轴上。对每个 ii(1≤i≤n1 \le i \le n),在坐标为 (i, 0)(i,\,0) 的位置恰好有一个望远镜。动物园中还有 mm 只火烈鸟,均位于坐标均为正数的点上。目前火烈鸟正在睡觉,你可以假设它们不会移动。

为了获得对火烈鸟的良好视野,每个望远镜均可独立地旋转至任意角度(角度不一定是整数)。随后,该望远镜即可观测到所有位于其设定角度所确定的直线上的火烈鸟。换言之,你可以为每个望远镜指定一个方向(即一条过该望远镜的任意直线),而该望远镜将能观测到该直线上所有的火烈鸟。

今天,来自著名 Codeforces 幼儿园的孩子们前往动物园开展野外考察活动。他们的老师希望为每个望远镜设定一个角度,使得该望远镜所能观测到的火烈鸟数量最大化。老师非常关心所有望远镜各自所能观测到的最大火烈鸟数量之和。请帮助他求出这个总和。

输入格式

The first line contains two space-separated integers n and m (1 ≤ n ≤ 106, 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 ≤ 109), which means that the i-th flamingo is located at point (x__i, y__i).

All flamingos will be located at distinct points.

第一行包含两个以空格分隔的整数 nn 和 mm(1 ≤ n ≤ 1061 ≤ n ≤ 10^6,1 ≤ m ≤ 2501 ≤ m ≤ 250),分别表示双筒望远镜的数量和火烈鸟的数量。

接下来是 mm 行,其中第 ii 行包含两个以空格分隔的整数 xix_i 和 yiy_i(1 ≤ xi, yi ≤ 1091 ≤ x_i,\, y_i ≤ 10^9),表示第 ii 只火烈鸟位于点 (xi, yi)(x_i,\, y_i)。

所有火烈鸟均位于互不相同的点上。

输出格式

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.

这张图片展示了示例测试用例的答案。

输入解题思路,AI测评打分。不知道怎么写?

首页