Submission #337378

#TimeUsernameProblemLanguageResultExecution timeMemory
337378Jarif_RahmanOdašiljači (COCI20_odasiljaci)C++17
70 / 70
290 ms4856 KiB
#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 timeMemoryGrader output
Fetching results...