Pagini recente » Cod sursa (job #2742953) | Cod sursa (job #2835856) | Cod sursa (job #2601897) | Cod sursa (job #1087192) | Cod sursa (job #1907249)
#include <bits/stdc++.h>
using namespace std;
#define mod 9973
struct meh
{
int x,y;
}a[100001];
double Min;
int n;
bool cmp1(meh a,meh b)
{
return (a.x<b.x || (a.x==b.x && a.y<b.y));
}
bool cmp2(meh a,meh b)
{
return (a.x>b.x || (a.x==b.x && a.y>b.y));
}
double d(meh a,meh b)
{
return sqrt(pow(a.x-b.x,2)+pow(a.y-b.y,2));
}
void cit()
{
freopen("cmap.in","r",stdin);
freopen("cmap.out","w",stdout);
}
int main()
{
cit();
Min=999999999;
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d %d",&a[i].x,&a[i].y);
sort(a+1,a+n+1,cmp1);
for(int i=2;i<=n;i++)
Min=min(Min,d(a[i],a[i-1]));
sort(a+1,a+n+1,cmp2);
for(int i=2;i<=n;i++)
Min=min(Min,d(a[i],a[i-1]));
printf("%lf",Min);
return 0;
}