# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
337378 | Jarif_Rahman | Odašiljači (COCI20_odasiljaci) | C++17 | 290 ms | 4856 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |