Pagini recente » Statistici Vasile Crisan (Thebreaker) | Cod sursa (job #2899396) | Cod sursa (job #135589) | Cod sursa (job #2261121) | Cod sursa (job #977579)
Cod sursa(job #977579)
#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 (Point[i].x-Point[j].x)*(Point[i].x-Point[j].x)+(Point[i].y-Point[j].y)*(Point[i].y-Point[j].y);
}
inline void Solve()
{
sol = (1LL<<60)-1;
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;
}