Codeforces886(Technocup2018) F Symmetric Projections
Codeforces886(Technocup2018) F Symmetric Projections
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.
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\) \(( - 10^6 ≤ x_i, y_i ≤ 10^6)\) — 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.
Examples
input
3
1 2
2 1
3 3
output
3
input
2
4 3
1 2
output
-1
Note
Picture to the first sample test:

In the second sample, any line containing the origin is good.
题意描述
在平面上给出2000个点,求有多少条过原点的直线, 使这些点在直线上的投影对称
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
题解
(因为精度问题没过)
质心是所有点的平均坐标
???质心在合法的直线上的投影是对称重心???
假设两点是对称的, 那么他们的中点的投影必然是对称中心, 结合质心的性质, 这样可以唯一确定一条过原点的直线
注意到任意一点一定有投影后对称的点, 可能是自己, 所以只要随便拿一个点和\(n\)个点枚举就可以得到所有的可能直线, 即\(O(n)\)
判断直线可不可行有很多方式
需要基准点的题目可以把所有坐标改成相对坐标, 简化计算
Codeforces886(Technocup2018) F Symmetric Projections的更多相关文章
- CF886F Symmetric Projections
题意:给你平面上n个点,问有多少条过原点的直线,使得这些点在该直线上的投影(做垂直,对应点)形成对称图形?n<=2000. 标程: #include<bits/stdc++.h> # ...
- Codeforces Round #445
ACM ICPC 每个队伍必须是3个人 #include<stdio.h> #include<string.h> #include<stdlib.h> #inclu ...
- Mysql_以案例为基准之查询
查询数据操作
- 1040. Longest Symmetric String (25)
题目链接:http://www.patest.cn/contests/pat-a-practise/1040 题目: 1040. Longest Symmetric String (25) 时间限制 ...
- 牛客多校第四场 F Beautiful Garden
链接:https://www.nowcoder.com/acm/contest/142/F来源:牛客网 题目描述 There's a beautiful garden whose size is n ...
- Fisheye projections from spherical maps [转]
Fisheye projections from spherical maps Written by Paul Bourke May 2003, software updated January 20 ...
- Educational Codeforces Round 9 F. Magic Matrix 最小生成树
F. Magic Matrix 题目连接: http://www.codeforces.com/contest/632/problem/F Description You're given a mat ...
- (第四场)F Beautiful Garden
题目: F Beautiful Garden 题目描述 There's a beautiful garden whose size is n x m in Chiaki's house. The ga ...
- pat1040. Longest Symmetric String (25)
1040. Longest Symmetric String (25) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, ...
随机推荐
- dataGridView1_RowEnter事件与dataGridView1.CurrentRow一起使用错误问题
在使用DataGridView想在选项行发生改变时获得当前行的,于是使用了RowEnter 但是获得数据却不对,总是获得前一个被选中的行,比如第一次选中谭经理,再选中王海霞,数据得到却是谭经理的 从事 ...
- 读取数据,并以txt格式保存
/// <summary> /// 读取数据,并以txt格式保存 /// </summary> /// <param name="data">数 ...
- 【翻译】tus----一个可续传文件上传的开放协议
tus tus是一个可续穿文件上传协议,它以Http协议为载体,统一了一个文件断点续传的标准. 这篇文章翻译自https://tus.io/ 目前该协议版本信息如下: Version: 1.0.0 ( ...
- git commit 统计
git log --author="username" --pretty=tformat: --numstat | awk '{ add += $1; subs += $2; lo ...
- 2.Shell脚本中的set指令,比如set -x 和 set -e
set参数介绍 set指令能设置所使用shell的执行方式,可依照不同的需求来做设置 -a 标示已修改的变量,以供输出至环境变量. -b 使被中止的后台程序立刻回报执行状态. -C 转向所产生的文件无 ...
- 如何简单使用tensorboard展示(一)
我使用tensorboard中的graph做了展示,至于其它功能可以类推,其代码如下: import numpy as npimport tensorflow as tf x_img = np.arr ...
- Unity Ioc 依赖倒置及Untity AOP被动拦截/自动拦截
各位博友金安,首先声明这是一篇转载的博客,原文链接:https://www.cnblogs.com/scottpei/archive/2013/01/08/2851087.html 十年河东,十年河西 ...
- SQL查询数据库中所有表、表字段名及数据类型
select b.name,a.colid,a.name ,())+')' from systypes where a.xusertype=systypes.xusertype ) type from ...
- c# 读取数据库得到dateset
public DataSet GetCraftInformation(string connectionString, string opName, string productType) ...
- 开关VoLTE流程分析(二)
AT指令,暂未发现发送AT请求的frameworks接口,通过打印信息总结AT指令: AT+EIMSVOICE: Enable/Disable IMS Voice Capability+EIMSVOI ...