# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
356754 | hra_ved | Odašiljači (COCI20_odasiljaci) | C++17 | 82 ms | 8664 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e3+1;
int par[MAXN];
vector <pair <double, pair <int, int> > > vect;
int Find(int x);
bool UnionFind(int x, int y);
int main() {
int N; cin>>N;
for (unsigned i = 0; i < N; ++i) par[i] = i;
double Xs[N+1], Ys[N+1];
for (unsigned i=0; i<N; ++i) {
cin>>Xs[i]>>Ys[i];
for (int j = 0; j < i; j++) {
double pit = sqrt( pow((Xs[i]- Xs[j]), 2) + pow((Ys[i]- Ys[j]), 2)) ;
vect.push_back(make_pair(pit, make_pair(i, j)));
}
}
sort(vect.begin(), vect.end());
double rj = 0.0;
for (unsigned i=0; i<vect.size(); ++i) {
if (UnionFind(vect[i].second.first,vect[i].second.second)){
rj = vect[i].first / 2;
}
}
printf("%.9f\n", rj);
}
int Find(int x) {
return (x == par[x]) ? x : par[x] = Find(par[x]);
}
bool UnionFind(int x, int y) {
x = Find(x);
y = Find(y);
if (x != y) {par[x] = y; return true;}
return false;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |