F. Symmetric Projections

Codeforces
IDCF886F
Time2000ms
Memory256MB
Difficulty
geometry
English · Original
Chinese · Translation
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](https://en.wikipedia.org/wiki/Point_reflection) in respect of point _P_. ## Input 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. ## Output If there are infinitely many good lines, print _\-1_. Otherwise, print single integer — the number of good lines. [samples] ## Note Picture to the first sample test: ![image](https://espresso.codeforces.com/eedc60313be8684bd6169b8b23f0f0afd92479a8.png) In the second sample, any line containing the origin is good.
给定平面上的一组 #cf_span[n] 个点。一条经过原点的直线被称为“好线”,如果将给定点集投影到这条直线上后,形成的点的多重集是对称的。求好线的总数。 多重集是指允许重复元素的集合。 一个多重集被称为对称的,如果存在平面上的一个点 #cf_span[P],使得该多重集关于点 #cf_span[P] 中心对称。 第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 2000]) —— 点集中的点数。 接下来的 #cf_span[n] 行,每行包含两个整数 #cf_span[xi] 和 #cf_span[yi] (#cf_span[ - 106  ≤  xi,  yi  ≤  106]) —— 点的坐标。保证没有两个点重合。 如果存在无穷多条好线,请输出 _-1_。 否则,输出一个整数 —— 好线的数量。 第一个样例的图示: 在第二个样例中,任意一条经过原点的直线都是好线。 ## Input 第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ≤ 2000]) —— 点集中的点数。接下来的 #cf_span[n] 行,每行包含两个整数 #cf_span[xi] 和 #cf_span[yi] (#cf_span[ - 106  ≤  xi,  yi  ≤  106]) —— 点的坐标。保证没有两个点重合。 ## Output 如果存在无穷多条好线,请输出 _-1_。否则,输出一个整数 —— 好线的数量。 [samples] ## Note 第一个样例的图示:在第二个样例中,任意一条经过原点的直线都是好线。
Samples
Input #1
3
1 2
2 1
3 3
Output #1
3
Input #2
2
4 3
1 2
Output #2
\-1
API Response (JSON)
{
  "problem": {
    "name": "F. Symmetric Projections",
    "description": {
      "content": "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 ",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF886F"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "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 ...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "给定平面上的一组 #cf_span[n] 个点。一条经过原点的直线被称为“好线”,如果将给定点集投影到这条直线上后,形成的点的多重集是对称的。求好线的总数。\n\n多重集是指允许重复元素的集合。\n\n一个多重集被称为对称的,如果存在平面上的一个点 #cf_span[P],使得该多重集关于点 #cf_span[P] 中心对称。\n\n第一行包含一个整数 #cf_span[n] (#cf_span[1 ≤ n ...",
      "is_translate": true,
      "language": "Chinese"
    }
  ]
}
Full JSON Raw Segments