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, ...
随机推荐
- win10下MYSQL的下载、安装以及配置超详解教程(转)
下载MYSQL 官网下载MYSQL5.7.21版本,链接地址https://www.mysql.com/downloads/.下载流程图如下: 进入官网点击Community,下载社区版. 找到MYS ...
- 【开源监控】Prometheus+Node Exporter+Grafana监控linux服务器
Prometheus Prometheus介绍 Prometheus新一代开源监控解决方案.github地址 Prometheus主要功能 多维 数据模型(时序由 metric 名字和 k/v 的 l ...
- Centos7.5 安装Mysql5.7
#yum -y install wget #wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rp ...
- C# 1.0 新特性之异步委托(AP、APM)
Ø 前言 C# 异步委托也是属于异步编程中的一种,可以称为 Asynchronous Programming(异步编程)或者 Asynchronous Programming Model(异步编程模 ...
- 基于verilog的分频器设计(半整数分频,小数分频:下)
第二种方法:对进行奇数倍n分频时钟,首先进行n/2分频(带小数,即等于(n-1)/2+0.5),然后再进行二分频得到.得到占空比为50%的奇数倍分频.下面讲讲进行小数分频的设计方法. 小数分频:首先讲 ...
- Prometheus 监控目标运行状态并邮件通知
Prometheus 监控目标运行状态并邮件通知 邮件服务安装:https://www.cnblogs.com/xiangsikai/p/9809654.html 告警规则示例:https://pro ...
- 2019-11-29-WPF-多个-StylusPlugIn-的事件触发顺序
原文:2019-11-29-WPF-多个-StylusPlugIn-的事件触发顺序 title author date CreateTime categories WPF 多个 StylusPlugI ...
- VS报错,Metadata file 'xxx.dll' could not be found
错误提示“Metadata file 'xxx.dll' could not be found”步骤如下:1.右键单击解决方案,然后单击“属性”.2.单击左侧的配置.3.确保选中了它找不到的项目的“生 ...
- C#/.Net操作MongoDBHelper类
先 NuGet两个程序集 1:MongoDB.Driver. 2:MongoDB.Bson namespace ConsoleApp1{ /// <summary> /// Mongo ...
- SpringIOC源码解析(下)
注意,看完这篇文章需要很长很长很长时间... 本篇文章是SpringIOC源码解析(上)的续集,上一篇文章介绍了使用XML的方式启动Spring,然后追踪了BeanFactory容器的创建.配置文件的 ...