| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 369584 | penguinhacker | Odašiljači (COCI20_odasiljaci) | C++14 | 206 ms | 8300 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ar array
int n, x[1000], y[1000];
ll d[1000][1000];
bool vis[1000];
void dfs(int i, double c) {
vis[i] = 1;
for (int j = 0; j < n; ++j) if (!vis[j] && d[i][j] <= 4 * c * c) dfs(j, c);
}
bool ok(double c) {
memset(vis, 0, sizeof(vis));
dfs(0, c);
return count(vis, vis + n, 1) == n;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
for (int i = 0; i < n; ++i) for (int j = i + 1; j < n; ++j)
d[i][j] = d[j][i] = (ll)(x[i] - x[j]) * (x[i] - x[j]) + (ll)(y[i] - y[j]) * (y[i] - y[j]);
double l = 0, r = 1e9;
for (int rep = 0; rep < 60; ++rep) {
double mid = (l + r) / 2;
if (ok(mid)) r = mid;
else l = mid;
}
cout << fixed << setprecision(6) << l;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
