Pagini recente » Cod sursa (job #1243699) | Istoria paginii runda/for_educational_purposes | Cod sursa (job #2257228) | Cod sursa (job #2402604) | Cod sursa (job #1470096)
# include <bits/stdc++.h>
using namespace std;
ifstream fi("cmap.in");
ofstream fo("cmap.out");
# define ll long long
struct pll
{
ll x,y;
};
bool operator < (pll a,pll b)
{
return (a.x == b.x ? a.y < b.y : a.x < b.x);
}
pll s[100005];
long double ans = (1LL << 62);
void update(pll a,pll b)
{
ans = min(ans,(long double)(sqrt(pow(a.x - b.x,2.) + pow(a.y - b.y,2.))));
}
int main(void)
{
int n;
fi>>n;
for (int i = 1;i <= n;++i) fi>>s[i].x>>s[i].y;
sort(s+1,s+1+n);
for (int i = 1;i <= n;++i)
for (int j = i + 1;j <= n && abs(s[i].x - s[j].x) < ans;++j)
if (abs(s[i].y - s[j].x) < ans)
update(s[i],s[j]);
return fo << fixed << setprecision(6) << ans << '\n',0;
}