# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
334595 | achibasadzishvili | Odašiljači (COCI20_odasiljaci) | C++14 | 63 ms | 8800 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
ll x[2001],y[2001],p[2005],n,sz[2005];
vector<pair<ll,pair<int,int> > >v;
ll find(ll x){
if(p[x] == x)return x;
return p[x] = find(p[x]);
}
int main(){
ios::sync_with_stdio(false);
cin >> n;
for(int i=1; i<=n; i++){
p[i] = i;
sz[i] = 1;
cin >> x[i] >> y[i];
}
for(int i=1; i<=n; i++){
for(int j=i+1; j<=n; j++){
v.pb(mp((x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]) , mp(i , j)));
}
}
sort(v.begin() , v.end());
for(int i=0; i<v.size(); i++){
ll x = v[i].s.f,y=v[i].s.s;
x = find(x);
y = find(y);
if(x == y)continue;
if(sz[y] > sz[x])swap(x , y);
sz[x] += sz[y];
if(sz[x] == n){
cout.precision(20);
cout << sqrt(v[i].f)/2.0 << '\n';
return 0;
}
p[y] = x;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |