# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
935067 | HossamHero7 | Odašiljači (COCI20_odasiljaci) | C++14 | 66 ms | 14024 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
struct dsu{
vector<int> par;
int comp;
dsu(int n){
par.resize(n);
iota(par.begin(),par.end(),0);
comp = n;
}
int getP(int node){
if(node == par[node]) return node;
return par[node] = getP(par[node]);
}
void add(int a,int b){
a = getP(a) , b = getP(b);
if(a == b) return;
par[b] = a;
comp --;
}
};
double dis(pair<int,int> p1 , pair<int,int> p2){
double x1 = p1.first , y1 = p1.second;
double x2 = p2.first , y2 = p2.second;
return sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
}
void solve(){
int n;
cin>>n;
vector<pair<int,int>> v(n);
for(auto &[x,y] : v) cin>>x>>y;
vector<array<double,3>> edges;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
edges.push_back({dis(v[i],v[j])/2,(double)i,(double)j});
}
}
sort(edges.begin(),edges.end());
dsu ds(n);
for(auto [r,a,b] : edges){
ds.add(a,b);
if(ds.comp == 1){
cout<<fixed<<setprecision(6)<<r<<endl;
return;
}
}
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int t=1;
//cin>>t;
while(t--){
solve();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |