# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1078121 | 12345678 | Odašiljači (COCI20_odasiljaci) | C++17 | 1068 ms | 600 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=1e3+5;
ll n, x[nx], y[nx], dsu[nx];
double l=0, r=2e9;
int find(int x)
{
if (dsu[x]==x) return x;
return dsu[x]=find(dsu[x]);
}
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n ;i++) cin>>x[i]>>y[i];
while (r-l>1e-8)
{
double md=(l+r)/2;
for (int i=1; i<=n; i++) dsu[i]=i;
for (int i=1; i<=n; i++)
{
for (int j=i+1; j<=n; j++) if ((double)((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))<=md*md) dsu[find(i)]=find(j);
}
int f=0;
for (int i=1; i<=n; i++) if (find(i)!=find(1)) f=1;
if (f) l=md;
else r=md;
}
printf("%.8llf", l);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |