Pagini recente » Cod sursa (job #1000379) | Cod sursa (job #953338) | Cod sursa (job #901543) | Cod sursa (job #3214940) | Cod sursa (job #2712345)
#include <bits/stdc++.h>
#define ll long long
#define pp pair<ll, ll>
#define x first
#define y second
using namespace std;
const int mxn = 100 * 1000 + 10;
pair <ll, ll> punct[ mxn ];
int n;
inline ll dist(pp a, pp b){
return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
inline ll distX(pp a, pp b){
return (a.x - b.x) * (a.x - b.x);
}
int main()
{
ifstream cin("cmap.in");
ofstream cout("cmap.out");
cin>> n;
for(int i = 0; i < n; i++){
cin>>punct[ i ].x >> punct[ i ].y;
}
sort(punct, punct + n);
ll sol = INT_MAX;
for(int i = 0; i < n - 1; i++){
for(int j = i + 1; j < n && distX(punct[ i ], punct[ j ]) <= sol; j++){
sol = min(sol, dist(punct[ i ], punct[ j ]));
}
}
cout<< setprecision( 6 ) << fixed << (double)sqrt(sol);
return 0;
}