# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
337378 | Jarif_Rahman | Odašiljači (COCI20_odasiljaci) | C++17 | 290 ms | 4856 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>
#define pb push_back
#define f first
#define sc second
using namespace std;
typedef long long int ll;
typedef string str;
typedef double ld;
vector<vector<int>> g;
vector<bool> bl;
void dfs(int nd){
if(bl[nd]) return;
bl[nd] = 1;
for(int x: g[nd]) dfs(x);
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
vector<pair<ld, ld>> v(n);
for(auto &p: v) cin >> p.f >> p.sc;
ld a = 0, b = 1e9;
while(1){
if(b-a <= (1e-6)) break;
ld c = (a+b)/2.0;
bool bll = 1;
g.clear();
g.resize(n);
bl.clear();
bl.resize(n, 0);
for(int i = 0; i < n; i++) for(int j = i+1; j < n; j++){
ld dis = (v[i].f-v[j].f)*(v[i].f-v[j].f) + (v[i].sc-v[j].sc)*(v[i].sc-v[j].sc);
dis = sqrt(dis);
dis/=2.0;
if(dis <= c){
g[i].pb(j);
g[j].pb(i);
}
}
dfs(0);
for(int i = 0; i < n; i++) bll&=bl[i];
if(bll) b = c;
else a = c;
}
cout << setprecision(100) << a << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |