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, ...
随机推荐
- Beta冲刺(9/7)——2019.5.31
作业描述 课程 软件工程1916|W(福州大学) 团队名称 修!咻咻! 作业要求 项目Beta冲刺(团队) 团队目标 切实可行的计算机协会维修预约平台 开发工具 Eclipse 团队信息 队员学号 队 ...
- Zookeeper原理图
- tomcat闪退的解决思路
用Tomcat总会遇到启动Tomcat闪退的问题. 什么叫闪退啊,就是闪一下,就退出了控制台. 都闪退了,为啥闪退也不知道呀,又没有错误信息,所以就要先阻止闪退,先看到错误信息,知道启动不起来的原因. ...
- 【leetcode-449】序列化和反序列化二叉搜索树
序列化是将数据结构或对象转换为一系列位的过程,以便它可以存储在文件或内存缓冲区中,或通过网络连接链路传输,以便稍后在同一个或另一个计算机环境中重建. 设计一个算法来序列化和反序列化二叉搜索树. 对序列 ...
- vs 发版时,在发版的文件夹中,找不到应该有的某个文件
检查:VS中,这个文件右击属性,查看生成操作.如果是“无”,改为“内容”.再重新发布就没问题了. 想看发版出来的内容包括哪些,可以从“发布”--“应用程序文件”查看
- Delphi - Delphi7 调用阿里大于实现短信消息验证
阿里大于是阿里通信旗下产品,融合了三大运营商的通信能力,提供包括短信.语音.流量直充.私密专线.店铺手机号等个性化服务.每条四分五,价钱还算公道,经老农测试,响应速度非常快,基本上是秒到.官方文档提供 ...
- Ubuntu 16.4系统下安装docker
本文将介绍在ubuntu16.04系统下安装和升级docker.docker-compose.docker-machine. docker:有两个版本:docker-ce(社区版)和docker-ee ...
- Centos下安装LoadRunner负载机
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAd0AAADfCAIAAAA84J6GAAAgAElEQVR4nJzb93cbR6In+uK/8v6Fd8
- 由MQTT topic的正则表达式匹配引发的特殊字符"/"匹配思考
正则表达式中的'/'替换 近期项目对接OneNET的MQTT物联网套件,需要完成命令下发流程. 流程要求: (1)设备在接收平台下发的命令(topic为$sys/{pid}/{device-name} ...
- python基础-面向对象编程之组合
面向对象编程之组合 定义:一个对象中拥有另一个或其他多个对象的属性和方法. 作用:减少代码的冗余,降低耦合度 关于耦合度的说明 耦合:通俗地讲,就是相互作用,相互影响的意思 耦合度越高,程序的可扩展性 ...