제출 #674716

#제출 시각아이디문제언어결과실행 시간메모리
674716rafatoaOdašiljači (COCI20_odasiljaci)C++17
70 / 70
70 ms352 KiB
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize ("Ofast") #define F first #define S second #define vi vector<int> #define vvi vector<vi> #define pi pair<int, int> #define vpi vector<pi> #define vb vector<bool> #define vvb vector<vb> #define pb push_back #define ppb pop_back #define read(a) for(auto &x:a) cin >> x; #define print(a) for(auto x:a) cout << x << " "; cout << "\n"; #define vc vector<char> #define vvc vector<vc> #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define int long long #define ld long double const int INF = 1e18; const int inf = 1e9; struct DSU{ vi link, sz; DSU(int n){ link = sz = vi(n); for(int i=0; i<n; i++) link[i] = i, sz[i] = 1; } int find(int x){ if(x == link[x]) return x; return link[x] = find(link[x]); } bool same(int a, int b){ return find(a) == find(b); } void unite(int a, int b){ a = find(a), b = find(b); if(a == b) return; if(sz[a] < sz[b]) swap(a, b); link[b] = a; sz[a] += sz[b]; } }; ld eps = 1e-6; void solve(){ int n; cin >> n; vi x(n), y(n); for(int i=0; i<n; i++) cin >> x[i] >> y[i]; ld l = 0, r = 2e9, k; while(r-l >= eps){ k = (l+r)/2; DSU dsu(n); for(int i=0; i<n; i++) for(int j=i+1; j<n; j++) if((x[i]-x[j])*(x[i]-x[j]) + (y[i]-y[j])*(y[i]-y[j]) <= k*k*4) dsu.unite(i, j); bool ok = 1; for(int i=0; i<n && ok; i++) ok &= (dsu.sz[dsu.find(i)] == n); if(ok) r = k; else l = k; } cout << fixed << setprecision(20) << l << "\n"; } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); // #ifndef ONLINE_JUDGE // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); // #endif int tt = 1; // cin >> tt; while(tt--) solve(); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...