# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334619 | GioChkhaidze | Odašiljači (COCI20_odasiljaci) | C++14 | 75 ms | 8664 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define F first
#define S second
using namespace std;
const int N=1e3+1;
int n,p[N],sz[N];
double x[N],y[N];
vector < pair < double , pair < int , int > > > v;
int P(int x) {
if (p[x]==x) return x;
return p[x]=P(p[x]);
}
main () {
cin>>n;
for (int i=1; i<=n; i++) {
cin>>x[i]>>y[i];
p[i]=i,sz[i]=1;
}
for (int i=1; i<=n; i++)
for (int j=1; j<i; j++)
v.pb({sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))/2.0,{i,j}});
sort(v.begin(),v.end());
for (int i=0; i<v.size(); i++) {
int a=v[i].S.F,b=v[i].S.S;
if (P(a)==P(b)) continue;
a=P(a),b=P(b);
p[b]=a;
sz[a]+=sz[b];
sz[b]=0;
if (sz[a]==n) {
printf("%.7f",v[i].F);
exit(0);
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |