# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
881003 | TAhmed33 | Odašiljači (COCI20_odasiljaci) | C++98 | 4 ms | 348 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>
using namespace std;
typedef long long ll;
int n;
pair <ll, ll> a[1001];
ll dist (int x, int y) {
return (a[x].first - a[y].first) * (a[x].first - a[y].first) + (a[x].second - a[y].second) * (a[x].second - a[y].second);
}
ll b[1001]; bool vis[1001]; const ll inf = 1e18;
int main () {
cin >> n;
for (int i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;
for (int i = 1; i <= n; i++) b[i] = inf - 1;
ll mx = 0;
for (int i = 1; i <= n; i++) {
ll pos = -1, mn = inf;
for (int j = 1; j <= n; j++) {
if (vis[j]) continue;
if (b[j] < mn) {
mn = b[j];
pos = j;
}
}
if (i != 1) mx = max(mx, b[pos]);
vis[pos] = 1;
for (int j = 1; j <= n; j++) {
if (!vis[j]) {
b[j] = min(b[j], dist(pos, j));
}
}
}
cout << fixed << setprecision(7) << sqrt(mx) / 2 << '\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |