Pagini recente » Cod sursa (job #166372) | Cod sursa (job #2952373) | Cod sursa (job #2372476) | Cod sursa (job #2427746) | Cod sursa (job #1681529)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <limits.h>
#include <cmath>
#include <iomanip>
using namespace std;
struct pct {
long long x;
long long y;
};
ifstream in("cmap.in");
ofstream out("cmap.out");
long long dist;
pct v[100003];
bool cmp(pct a, pct b) {
if(a.x != b.x)
return a.x < b.x;
else
return a.y < b.y;
}
long long sm(int st, int dr) {
//if(st >= dr)
// return INT_MAX;
if(dr == st+1)
return ((v[st].x-v[dr].x)*(v[st].x-v[dr].x) + (v[st].y-v[dr].y)*(v[st].y-v[dr].y));
//cout << st << " " << dr << '\n';
int mid = (st+dr)/2;
return min(sm(st, mid), sm(mid, dr));
}
int main() {
int n;
in >> n;
for(int i = 1; i <= n; i++)
in >> v[i].x >> v[i].y;
sort(v, v+n, cmp);
//cout << sm(1, n);
out << fixed << setprecision(6) << sqrt(sm(1, n));
return 0;
}