| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 630145 | Hacv16 | Odašiljači (COCI20_odasiljaci) | C++17 | 288 ms | 51524 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
const int MAX = 2e6 + 15;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const ld eps = 1e-7;
#define pb push_back
#define sz(x) (int) x.size()
#define fr first
#define sc second
#define mp make_pair
#define all(x) x.begin(), x.end()
#define dbg(x) cerr << #x << ": " << "[ " << x << " ]\n"
struct Antena{
int id;
ld x, y;
Antena(int i = 0, ld a = 0.0, ld b = 0.0){
id = i, x = a, y = b;
}
ld dist(Antena other){
ld dx = x - other.x, dy = y - other.y;
return dx * dx + dy * dy;
}
};
int n, seen[MAX], cnt;
vector<Antena> v;
vector<int> adj[MAX];
void dfs(int u){
seen[u] = true, cnt++;
for(auto v : adj[u]){
if(!seen[v]) dfs(v);
}
}
bool check(ld d){
for(int i = 0; i < n; i++){
adj[i].clear();
seen[i] = false;
}
cnt = 0;
for(int i = 0; i < n; i++)
for(int j = i + 1; j < n; j++)
if(v[i].dist(v[j]) <= d * d)
adj[v[i].id].pb(v[j].id), adj[v[j].id].pb(v[i].id);
dfs(0);
return (cnt == n);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i = 0; i < n; i++){
ld x, y; cin >> x >> y;
v.pb(Antena(i, x, y));
}
long double l = 0, r = 1e10, ans = -1;
while(r - l > eps){
ld m = (r + l) / 2.0;
if(check(m)) r = m, ans = m;
else l = m;
}
cout << setprecision(15) << fixed << ans / 2.0 << '\n';
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
