Pagini recente » Cod sursa (job #1537708) | Rating Grama Andrei (Grama911) | Cod sursa (job #1190541) | Cod sursa (job #810233) | Cod sursa (job #1197512)
#include <cstdio>
#include <algorithm>
#include <cmath>
#define N 100010
using namespace std;
struct punct
{
double x,y;
}P[N];
double sol=2000000010.0;
int i,j,n;
double dist(punct a,punct b)
{
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
bool cmp(punct a,punct b)
{
if(a.x==b.x)
return a.y<b.y;
return a.x<b.x;
}
int main()
{
freopen("cmap.in","r",stdin);
freopen("cmap.out","w",stdout);
scanf("%d",&n);
for(i=1;i<=n;i++)
scanf("%lf%lf",&P[i].x,&P[i].y);
sort(P+1,P+n+1,cmp);
for(i=1;i<=n;i++)
for(j=i+1;j<=i+7&&j<=n;j++)
sol=min(sol,dist(P[i],P[j]));
printf("%.6lf",sol);
return 0;
}