The Preliminary Contest for ICPC Asia Xuzhou 2019 K Center

You are given a point set with nnn points on the 2D-plane, your task is to find the smallest number of points you need to add to the point set, so that all the points in the set are center symmetric.

All the points are center symmetric means that you can find a center point (Xc,Yc)(X_c,Y_c)(Xc​,Yc​)(not necessarily in the point set), so that for every point (Xi,Yi)(X_i,Y_i)(Xi​,Yi​) in the set, there exists a point (Xj,Yj)(X_j,Y_j)(Xj​,Yj​) (iii can be equal to jjj) in the set satisfying Xc=(Xi+Xj)/2X_c=(X_i+X_j)/2Xc​=(Xi​+Xj​)/2 and Yc=(Yi+Yj)/2Y_c=(Y_i+Y_j)/2Yc​=(Yi​+Yj​)/2.

Input

The first line contains an integer n(1≤n≤1000)n(1 \le n \le 1000)n(1≤n≤1000).

The next nnn lines contain nnn pair of integers (Xi,Yi)(X_i,Y_i)(Xi​,Yi​) (−106≤Xi,Yi≤106)(-10^6 \le X_i,Y_i \le 10^6)(−106≤Xi​,Yi​≤106) -- the points in the set

Output

Output a single integer -- the minimal number of points you need to add.

样例输入

3
2 0
-3 1
0 -2

样例输出

1

样例解释

For sample 111, add point (5,−3)(5,-3)(5,−3) into the set, the center point can be (1,−1)(1,-1)(1,−1) .

题意:给你n个点的坐标,问最少再添加多少个点才能使所以点都关于某一点中心对称

思路:枚举中心点(每两个点都有一个中心点),看每个中心点有多少个点关于他对称,纪录最多的那个点,又由于有一些点可能正好位于中心点的位置,这要预先纪录

#include<stdio.h>
#include<math.h>
#include<vector>
#include<cstring>
#include<queue>
#include<iostream>
#include<algorithm>
#include<map>
using namespace std;
typedef pair<int,int> p;
map<pair<int,int>,int>mp;
map<pair<int,int>,int>mp2;
int a[1002],b[1002];
int main(){
	int n;
	scanf("%d",&n);
	int ans = 0;
	for(int i = 1; i <= n; i++){
		scanf("%d%d",&a[i],&b[i]);
		mp2[p(a[i],b[i])]++;
	}
	double ansx,anxy;
	for(int i = 1; i <= n; i++)
	for(int j = i+1; j <= n; j++){
		int x = a[i]+a[j];
		int y = b[i]+b[j];
		mp[p(x,y)]++;
		if(x%2==0&&y%2==0){
			if(ans<2*mp[p(x,y)]+mp2[p(x/2,y/2)]){
				ans=2*mp[p(x,y)]+mp2[p(x/2,y/2)];
			}
		}
		else{
			if(ans<2*mp[p(x,y)]){
				ans=2*mp[p(x,y)];
			}
		}
	}
	if(n == 1) printf("0\n");
	else
	printf("%d\n",n-ans);
}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sure, I'd be happy to give you some ideas for organizing a speech contest. Here are some suggestions: 1. Determine the theme and rules: Decide on the theme of the contest and the rules for participants. Will it be an open topic, or will there be a specific theme? What is the maximum length of the speech? Will there be any specific guidelines for language or content? 2. Decide on the judging criteria: Determine how the speeches will be evaluated. Will judges be looking for content, delivery, or both? Will there be a score sheet or rubric that judges will use to score the speeches? 3. Recruit judges: Find people who are qualified to judge the speeches. Ideally, they should have experience in public speaking or have a background in the theme of the contest. 4. Promote the contest: Advertise the contest to potential participants, such as students, professionals, or members of a specific community. Use social media, flyers, and other methods to get the word out. 5. Registration and selection: Set a deadline for registration and selection of participants. Consider having a preliminary round to narrow down the field before the final competition. 6. Prepare the venue: Ensure that the venue is suitable for the contest. Make sure that there is adequate seating, sound equipment, and lighting for the speakers. 7. Hold the contest: Set a date and time for the contest, and make sure that all participants and judges are aware of the schedule. Encourage audience participation and provide refreshments. 8. Award ceremony: After the contest, hold an award ceremony to recognize the winners and participants. Provide certificates or other prizes to the top performers. I hope these ideas help you in organizing a successful speech contest!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值