Pagini recente » Cod sursa (job #1282128) | Cod sursa (job #1188751) | Cod sursa (job #1736744) | Cod sursa (job #998082) | Cod sursa (job #977584)
Cod sursa(job #977584)
#include <fstream>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define In "cmap.in"
#define Out "cmap.out"
#define Nmax 100004
#define x first
#define y second
using namespace std;
pair<int, int > Point[Nmax];
int N;
long long sol;
inline void Read()
{
ifstream in(In);
in>>N;
for(int i = 1 ;i<=N;++i)
in>>Point[i].x>>Point[i].y;
sort(Point+1,Point+N+1);
}
inline long long Dist(const int i,const int j)
{
return 1LL*(Point[i].x-Point[j].x)*(Point[i].x-Point[j].x)+1LL*(Point[i].y-Point[j].y)*(Point[i].y-Point[j].y);
}
inline void Solve()
{
sol = Dist(1,N);
int i, j;
long long x;
for(i = 1;i < N; ++i)
for(j = i+1 ;j <= N; ++j)
{
x = Dist(i,j);
if(1LL*(Point[j].x-Point[i].x)*(Point[j].x-Point[i].x)>sol)
break;
sol = min(sol,x);
}
}
inline void Write()
{
ofstream out(Out);
out<<fixed<<setprecision(6)<<sqrt(1.0*sol)<<"\n";
out.close();
}
int main()
{
Read();
Solve();
Write();
return 0;
}