记录编号 41499 评测结果 WWWWWWWWWW
题目名称 [河南省队2012] 信使问题b 最终得分 0
用户昵称 GravatarMakazeu 是否通过 未通过
代码语言 C++ 运行时间 0.003 s
提交时间 2012-07-23 16:45:22 内存使用 1.82 MiB
显示代码纯文本
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <ctime>
using namespace std;
int N;
const int MAXN=100100;
double point[MAXN][2];

inline double get(int i,int j)
{
	double x=(point[i][0]-point[j][0])*(point[i][0]-point[j][0]);
	double y=(point[i][1]-point[j][1])*(point[i][1]-point[j][1]);
	return sqrt(x+y);
}

inline void init()
{
	scanf("%d\n",&N);
	for(int i=1;i<=N;i++)
		scanf("%lf %lf\n",&point[i][0],&point[i][1]);
}

inline double Max(double a,double b)
{
	return a>b?a:b;
}

inline double Min(double a,double b)
{
	return a<b?a:b;
}

inline double abbs(double a)
{
	return a>0?a:-a;
}

inline void baori()
{
	double max=double(0);
	double min=1e10;
	double tmp;
	for(int i=1;i<=N;i++)
	{
		for(int j=i+1;j<=N;j++)
		{
			/*
			if(abbs(point[i][0]-point[j][0])>=min &&
						abbs(point[i][0]-point[j][0])+
						abbs(point[i][1]-point[j][1])<=min)
			continue;*/
			tmp=get(i,j);
			max=Max(max,tmp);
			min=Min(min,tmp);
		}
	}
	printf("%.4lf\n%.4lf\n",max,min);
}

int main()
{
	freopen("in","r",stdin);
	freopen("postmanb.in","r",stdout);
	freopen("postmanb.out","w",stdout);
	init();
	baori();
	printf("%d\n",clock());
	return 0;
}