Pagini recente » Cod sursa (job #2560010) | Cod sursa (job #1132061) | Cod sursa (job #3174723) | Cod sursa (job #2449366) | Cod sursa (job #2712335)
#include <bits/stdc++.h>
#define pp pair<int, int>
#define x first
#define y second
using namespace std;
const int mxn = 100 * 1000 + 10;
pair <int, int> punct[ mxn ];
int n;
inline int dist(pp a, pp b){
return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}
inline int 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);
int 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;
}