#include <bits/stdc++.h>
#define fore(i, a, b) for (ll i = (a), _b = (b); i < _b; ++i)
#define fort(i, a, b) for (ll i = (a), _b = (b); i <= _b; ++i)
#define ford(i, a, b) for (ll i = (a), _b = (b); i >= _b; --i)
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
template<class A, class B> bool maxi(A &a, const B &b) {return (a < b) ? (a = b, true):false;};
template<class A, class B> bool mini(A &a, const B &b) {return (a > b) ? (a = b, true):false;};
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef pair<ll, ii> Edge;
struct DisjointSet {
std::vector<int> r;
DisjointSet() {};
DisjointSet(const int n): r(n, -1) {};
void build() {
std::fill(r.begin(), r.end(), -1);
};
int root(const int x) {
return r[x] < 0 ? x : (r[x] = root(r[x]));
}
bool unite(int x, int y) {
x = root(x);
y = root(y);
if (x == y)
return false;
if (r[x] > r[y])
std::swap(x, y);
r[x] += r[y];
r[y] = x;
return true;
}
bool connected(const int x, const int y) {
return root(x) == root(y);
}
int treeSize(const int x) {
return -r[root(x)];
}
};
ll sqr(const ll x) {
return x * x;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("main.INP", "r", stdin);
#endif // LOCAL
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
double res = 0;
cin >> n;
DisjointSet dsu(n);
vi x(n), y(n);
vector<Edge> e;
fore(i, 0, n)
cin >> x[i] >> y[i];
fore(i, 1, n)
fore(j, 0, i)
e.pb(Edge(sqr(x[i] - x[j]) + sqr(y[i] - y[j]), ii(i, j)));
sort(all(e));
for (const Edge &i : e)
if (dsu.unite(i.se.fi, i.se.se))
res = sqrt(i.fi) / 2;
cout << setprecision(6) << fixed << res << '\n';
return 0;
}
Compilation message
odasiljaci.cpp: In function 'int main()':
odasiljaci.cpp:61:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
61 | freopen("main.INP", "r", stdin);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
2 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
3 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
4 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
5 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
7 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |
8 |
Incorrect |
4 ms |
364 KB |
Output isn't correct |
9 |
Incorrect |
2 ms |
364 KB |
Output isn't correct |
10 |
Incorrect |
3 ms |
364 KB |
Output isn't correct |