Pagini recente » Cod sursa (job #2417393) | Cod sursa (job #753911) | Cod sursa (job #235907) | Cod sursa (job #2573681) | Cod sursa (job #2834895)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("cmap.in");
ofstream fout("cmap.out");
const int dim=100009;
struct punct{
int x,y;
bool operator <(const punct &other) const
{
if(x==other.x){
return y<other.y;
}
return x<other.x;
}
};
set<punct>s;
punct v[dim];
bool cmp(punct a, punct b){
if(a.x==b.x){
return a.y<b.y;
}
return a.x<b.x;
}
double dist(punct a,punct b){
return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}
signed main(){
int n;
fin>>n;
for(int i=1;i<=n;i++){
fin>>v[i].x>>v[i].y;
}
sort(v+1,v+n+1);
double hmax=dist(v[1],v[2]);
for(int i=1;i<=n;i++){
auto it=s.begin();
while(dist(v[i],*it)>hmax&&it!=s.end()){
s.erase(*it);
it=s.begin();
}
for(auto other:s){
hmax=min(hmax,dist(other,v[i]));
}
s.insert(v[i]);
}
fout<<fixed<<setprecision(8)<<hmax;
}