| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 872103 | SalihSahin | Odašiljači (COCI20_odasiljaci) | C++17 | 94 ms | 480 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define int long long
using namespace std;
const int N = 1e3 + 5;
const int mod = 1e9+7;
int par[N];
int find(int a){
if(a == par[a]) return a;
return par[a] = find(par[a]);
}
bool merge(int a, int b){
a = find(a);
b = find(b);
if(a == b) return 0;
par[b] = a;
return 1;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
vector<pair<double, double> > a(n);
for(int i = 0; i < n; i++){
cin>>a[i].first>>a[i].second;
}
double diff = 1e-7;
double l = 0, r = 1e10;
while(l + diff < r){
double mid = (l + r)/2;
int g = n;
for(int i = 0; i < n; i++) par[i] = i;
for(int i = 0; i < n; i++){
for(int j = i+1; j < n; j++){
double dis = sqrt((a[i].first - a[j].first)*(a[i].first - a[j].first) + (a[i].second - a[j].second)*(a[i].second - a[j].second));
if(mid * 2 >= dis){
g -= merge(i, j);
}
}
}
if(g == 1){
r = mid;
}
else l = mid;
}
printf("%.7f \n", l);
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
