The Preliminary Contest for ICPC Asia Xuzhou 2019 K. Center
这题对于能加入最多边缘点的center点,这个点就是最优的center ,对于center点,总共是n^2的,顶多也就1e6,所以直接双重循环就行了, 然后map<pair,set >映射一下,第二个用set是因为虽然同一个中心点,对应的边缘点不会出现两次,但是题目中允许一个点作为边缘点两次 ,所以去重的是自己和自己相同的点。
最后输出以下答案就可以了。
#include <bits/stdc++.h>
using namespace std;
typedef pair<double,double> Pair;
map<Pair,set<Pair> >mp;
Pair p[1010];
#define pf(x) p[x].first
#define ps(x) p[x].second
int main()
{
// ios::sync_with_stdio(false);
int N;
// cin>>N;
scanf("%d",&N);
for (int i=0;i<N;i++) {
//cin>>pf(i)>>ps(i);
scanf("%lf%lf",&pf(i),&ps(i));
}
int res=-1;
for (int i=0;i<N;i++) {
for (int j=i;j<N;j++) {
Pair x=make_pair((pf(i)+pf(j))/2,(ps(i)+ps(j))/2);
mp[x].insert(p[i]);
mp[x].insert(p[j]);
int size=mp[x].size();
res=size>res?size:res;
}
}
printf("%d\n",N-res);
return 0;
}
The Preliminary Contest for ICPC Asia Xuzhou 2019 K. Center的更多相关文章
- 计蒜客 41391.query-二维偏序+树状数组(预处理出来满足情况的gcd) (The Preliminary Contest for ICPC Asia Xuzhou 2019 I.) 2019年徐州网络赛)
query Given a permutation pp of length nn, you are asked to answer mm queries, each query can be rep ...
- The Preliminary Contest for ICPC Asia Xuzhou 2019 E XKC's basketball team [单调栈上二分]
也许更好的阅读体验 \(\mathcal{Description}\) 给n个数,与一个数m,求\(a_i\)右边最后一个至少比\(a_i\)大\(m\)的数与这个数之间有多少个数 \(2\leq n ...
- The Preliminary Contest for ICPC Asia Xuzhou 2019
A:Who is better? 题目链接:https://nanti.jisuanke.com/t/41383 题意: 类似于有N个石子,先手第一次不能拿完,每次后手只能拿 1 到 前一次拿的数量* ...
- The Preliminary Contest for ICPC Asia Xuzhou 2019 E. XKC's basketball team
题目链接:https://nanti.jisuanke.com/t/41387 思路:我们需要从后往前维护一个递增的序列. 因为:我们要的是wi + m <= wj,j要取最大,即离i最远的那个 ...
- 计蒜客 41387.XKC's basketball team-线段树(区间查找大于等于x的最靠右的位置) (The Preliminary Contest for ICPC Asia Xuzhou 2019 E.) 2019年徐州网络赛
XKC's basketball team XKC , the captain of the basketball team , is directing a train of nn team mem ...
- The Preliminary Contest for ICPC Asia Xuzhou 2019 【 题目:so easy】{并查集维护一个数的下一个没有被删掉的数} 补题ING
题意:给[1,n],n个数,有两种操作: 1 x,删去x2 x,查询还未被删去的数中大于等于x的最小的数是多少. input: output: 做法:按照并查集的方法压缩路径 代码: #include ...
- G.Colorful String(The Preliminary Contest for ICPC Asia Xuzhou 2019)
https://nanti.jisuanke.com/t/4 #include <bits/stdc++.h> using namespace std; ,; typedef unsign ...
- E.XKC's basketball team(The Preliminary Contest for ICPC Asia Xuzhou 2019)
https://nanti.jisuanke.com/t/41387 解: 离散化+线段树. #define IOS ios_base::sync_with_stdio(0); cin.tie(0); ...
- A.Who is better?(The Preliminary Contest for ICPC Asia Xuzhou 2019)
https://nanti.jisuanke.com/t/41383 解: 斐波那契博弈+中国剩余定理. #include <bits/stdc++.h> using namespace ...
随机推荐
- 在SQL2005中修改数据库名称
SQL Server 2005中有个数据库HT_WisdomDataBaseCenter,现在要将其改名为HT_NBSBOneNetcs1步骤:(1) 分离数据库:打开management studi ...
- Big research problems (1)
1. how to measure the uncertainty of prediction model or data analysis? 2.
- ssh: connect to git@gitlab.xxxxx.com:xxxxx.git port 22: Connection refused
公司服务器上的gitlab项目添加了ssh密钥,但是操作时却报错ssh: connect to git@gitlab.xxxxx.com:xxxxx.git port 22: Connection r ...
- vue基础实例
<html> <head> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"> ...
- 随缘记录 LeetCode第168场周赛 2019-12-22
5292. 划分数组为连续数字的集合 给你一个整数数组 nums 和一个正整数 k,请你判断是否可以把这个数组划分成一些由 k 个连续数字组成的集合. 如果可以,请返回 True:否则,返回 Fals ...
- Bayer Pattern
在刚加入工作的时候,听到最多的就是RGGB Bayer Pattern.在之前的接触中,一直默认一张图片的每个像素点有RGB三个分量,那“RGGB Bayer Pattern”究竟是什么意思.在网上查 ...
- CAD 批量提取点坐标,实现坐标的快速提取
原创 CAD 批量提取点坐标,实现坐标的快速提取 2018-08-07 20:36:13 caohongji 阅读数 13678 版权声明:本文为博主原创文章,遵循CC 4.0 BY-SA版权协议 ...
- $ ssh -T -v git@github.com_在本地用ssh连接github出错_git@github.com: Permission denied (publickey).
$ ssh -T -v git@github.com报错: debug1: Authentications that can continue: publickey debug1: Next auth ...
- windows10桌面突然变灰了
不靠谱的第三方软件重装系统,装了以后系统有点问题,会隔一段时间变灰 了 windows+ctrl+c 直接就恢复色彩了
- pycharm pro与你同在
下载激活码和激活依赖的jar包,地址(https://www.lanzous.com/b00t4aneb密码:67t9)按照步骤操作即可第一步:正确安装 Pycharm 软件(版本2019.1.3 p ...