CF886F.Symmetric Projections

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

You are given a set of n points on the plane. A line containing the origin is called good, if projection of the given set to this line forms a symmetric multiset of points. Find the total number of good lines.

Multiset is a set where equal elements are allowed.

Multiset is called symmetric, if there is a point P on the plane such that the multiset is centrally symmetric in respect of point P.

给定平面上的 $ n $ 个点。一条过原点的直线称为好直线,如果将给定点集投影到该直线上后,所得点构成一个对称的多重集。求好直线的总数。

多重集(multiset)是指允许包含重复元素的集合。

若存在平面上某一点 $ P $,使得该多重集关于点 $ P $ 中心对称(中心对称),则称该多重集为对称多重集。

输入格式

The first line contains a single integer n (1 ≤ n ≤ 2000) — the number of points in the set.

Each of the next n lines contains two integers x__i and y__i ( - 106  ≤  x__i,  y__i  ≤  106) — the coordinates of the points. It is guaranteed that no two points coincide.

第一行包含一个整数 nn(1≤n≤20001 \leq n \leq 2000)—— 表示集合中点的个数。

接下来的 nn 行,每行包含两个整数 xix_i 和 yiy_i(−106≤xi,yi≤106-10^6 \leq x_i, y_i \leq 10^6)—— 表示各点的坐标。保证任意两点不重合。

输出格式

If there are infinitely many good lines, print -1.

Otherwise, print single integer — the number of good lines.

如果存在无穷多条好直线,则输出 -1。

否则,输出一个整数——好直线的数量。

输入输出样例

  • 输入#1

    3
    1 2
    2 1
    3 3

    输出#1

    3
  • 输入#2

    2
    4 3
    1 2

    输出#2

    -1

说明/提示

Picture to the first sample test:

In the second sample, any line containing the origin is good.

第一个样例测试的图示:

在第二个样例中,任何经过原点的直线都是可行的。

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

首页