Pagini recente » Cod sursa (job #1709448) | Cod sursa (job #2433536) | Cod sursa (job #1531481) | Cod sursa (job #446527) | Cod sursa (job #2100583)
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
#define rc(x) return cout<<x<<endl,0
#define pb push_back
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define sz size()
#define pb push_back
const ll mod = 1e9 + 7;
int n;
map <int, int> m;
vector <pair<ll, ll>> v;
ll x, y;
bool sortbysec(const pair<int,int> &a,
const pair<int,int> &b)
{
return (a.second < b.second);
}
int32_t main(){
ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
ifstream fin("cmap.in");
ofstream fout("cmap.out");
//int x; cin>>x; cout<<fixed<<setprecision(11)<<(long double)sqrt(x);
fin>>n;
for(int i=0; i<n; i++){fin>>x>>y; v.pb(make_pair(x, y));}
sort(v.begin(), v.end());
for(int i=0; i<n; i++){ int k=i;
while(v[i].first==v[i+1].first){i++;}
sort(v.begin()+k, v.begin()+i+1, sortbysec);
}
long double d=1000000000000;
for(int i=0; i<n-1; i++){
if((long double)sqrt((v[i].first-v[i+1].first)*(v[i].first-v[i+1].first)+(v[i].second-v[i+1].second)*(v[i].second-v[i+1].second))<d)
d=(long double)sqrt((v[i].first-v[i+1].first)*(v[i].first-v[i+1].first)+(v[i].second-v[i+1].second)*(v[i].second-v[i+1].second));
} fout<<fixed<<setprecision(11)<<d;
}