#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000;
int N;
int par[maxn];
double Dist(double a1, double a2, double b1, double b2) {
return sqrt(pow(a1-b1,2) + pow(a2-b2,2));
}
int Find(int x) {
return (x == par[x]) ? x : par[x] = Find(par[x]);
}
bool Union(int x, int y) {
x = par[x];
y = par[y];
if (x != y) {par[x] = y; return true;}
return false;
}
int main() {
cin >> N;
double x[N], y[N];
vector <pair <double, pair <int, int> > > v;
for (int i = 0; i < N; i++) par[i] = i;
for (int i = 0; i < N; i++) {
cin >> x[i] >> y[i];
for (int j = 0; j < i; j++) {
v.push_back({Dist(x[i], y[i], x[j], y[j]), {i, j}});
}
}
sort(v.begin(), v.end());
double ans = 0.0;
for (int i = 0; i < v.size(); i++) {
if (Union(v[i].second.first, v[i].second.second)) ans = v[i].first / 2;
}
printf("%.9f \n", ans);
}
Compilation message
odasiljaci.cpp: In function 'int main()':
odasiljaci.cpp:37:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<double, std::pair<int, int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
37 | for (int i = 0; i < v.size(); i++) {
| ~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
2 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
5 |
Incorrect |
1 ms |
492 KB |
Output isn't correct |
6 |
Incorrect |
22 ms |
2528 KB |
Output isn't correct |
7 |
Incorrect |
23 ms |
2528 KB |
Output isn't correct |
8 |
Incorrect |
53 ms |
8616 KB |
Output isn't correct |
9 |
Incorrect |
80 ms |
8688 KB |
Output isn't correct |
10 |
Incorrect |
89 ms |
8664 KB |
Output isn't correct |