# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
445479 | grt | Odašiljači (COCI20_odasiljaci) | C++17 | 64 ms | 8640 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ST first
#define ND second
#define PB push_back
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
struct P {
int x, y;
};
const int nax = 1000 + 10;
int n;
P p[nax];
vector<tuple<ll,int,int>>d;
int par[nax], siz[nax];
int Fund(int x) {
if(par[x] != x) par[x] = Fund(par[x]);
return par[x];
}
ll ans;
void Onion(int a, int b, ll c) {
a = Fund(a); b = Fund(b);
if(a == b) return;
ans = c;
if(siz[a] < siz[b]) swap(a, b);
siz[a] += siz[b];
par[b] = a;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 0; i < n; ++i) {
cin >> p[i].x >> p[i].y;
par[i] = i;
siz[i] =1;
}
for(int i = 0; i < n; ++i) {
for(int j = i + 1; j < n; ++j) {
d.PB({(ll)(p[i].x - p[j].x) * (p[i].x - p[j].x) + (ll)(p[i].y - p[j].y) * (p[i].y - p[j].y), i, j});
}
}
sort(d.begin(), d.end());
for(auto [c, u, v] : d) {
Onion(u,v,c);
}
long double res = sqrtl(ans) / 2.0;
cout << setprecision(10);
cout << fixed;
cout << res;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |