比赛 |
20110724 |
评测结果 |
AAAWTTATTT |
题目名称 |
遥远的距离 |
最终得分 |
40 |
用户昵称 |
.Xmz |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2011-07-24 10:38:29 |
显示代码纯文本
#include <iostream>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <algorithm>
using namespace std;
struct point
{
int x,y;
}P[100001];
int n,m,T;
bool cmp(const point &a,const point &b)
{
return (a.x < b.x);
}
double dis(int u,int v)
{
return sqrt((double)(P[u].x-P[v].x)*(double)(P[u].x-P[v].x)+(double)(P[u].y-P[v].y)*(double)(P[u].y-P[v].y));
}
int main()
{
freopen("faraway.in","r",stdin);
freopen("faraway.out","w",stdout);
scanf("%d",&T);
for (;T;--T)
{
scanf("%d%d",&m,&n);
for (int i=1;i<=n+m;i++)
scanf("%d%d",&P[i].x,&P[i].y);
sort(P+1,P+n+m+1,cmp);
double ans=0;
for (int i=1;i<=n;i++)
for (int j=n+1;j<=n+m;j++)
ans=max(ans,dis(i,j));
printf("%0.3lf\n",ans);
}
return 0;
}