Pagini recente » Cod sursa (job #1006048) | Monitorul de evaluare | Cod sursa (job #452092) | Cod sursa (job #187714) | Cod sursa (job #1623743)
#include <cmath>
#include <fstream>
#include <iomanip>
#include <algorithm>
#define NMAX 100005
#define INF 1000000000000000000
using namespace std;
struct punct{
long long x,y;
}v[NMAX];
inline bool comp(punct p1,punct p2){
return p1.x+p1.y<p2.x+p2.y;
}
inline long long min(long long a,long long b){
if (a<=b)return a;
return b;
}
inline long long dist(punct a,punct b){
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
int main()
{
ifstream f("cmap.in");
ofstream g("cmap.out");
int n;long long sol=INF;
f>>n;
for (int i=1;i<=n;i++)f>>v[i].x>>v[i].y;
sort(v+1,v+n+1,comp);
for (int i=1;i<=n;i++)
for (int j=i+1;j<=i+7 && j<=n;j++){
sol=min(sol,dist(v[i],v[j]));
}
g<<fixed<<setprecision(6)<<sqrt((long long)sol);
fclose(stdin);
fclose(stdout);
}