結果
| 問題 |
No.94 圏外です。(EASY)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-06-19 21:43:36 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 5,000 ms |
| コード長 | 1,196 bytes |
| コンパイル時間 | 2,215 ms |
| コンパイル使用メモリ | 198,332 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-06-19 21:43:40 |
| 合計ジャッジ時間 | 3,521 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 22 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define FOR(x,to) for(x=0;x<to;x++)
class UF {
public:
static const int ufmax=1052;
int ufpar[ufmax],ufrank[ufmax],ufcnt[ufmax];
UF() { init();}
void init(){int i; FOR(i,ufmax) { ufpar[i]=i; ufrank[i]=0; ufcnt[i]=1; } }
int find(int x) { return (ufpar[x]==x)?(x):(ufpar[x] = find(ufpar[x]));}
int operator[](int x) {return find(x);}
int count(int x) {return ufcnt[find(x)];}
void unite(int x,int y) {
x = find(x); y = find(y);
if(x==y) return;
if(ufrank[x]<ufrank[y]) ufpar[x]=y, ufcnt[y]+=ufcnt[x];
else {ufpar[y]=x; ufcnt[x]+=ufcnt[y]; if(ufrank[x]==ufrank[y]) ufrank[x]++;}
}
};
UF uf;
int X[1001], Y[1001];
int dist(int i, int j){
return pow(X[i]-X[j],2)+pow(Y[i]-Y[j],2);
}
void solve(){
int N; cin>>N;
int i,j;
FOR(i,N){
cin>>X[i]>>Y[i];
}
FOR(i,N) FOR(j,N) if(dist(i, j) <= 100) uf.unite(i,j);
double ma=1;
if(N)ma=2;
FOR(i,N) FOR(j,N) if(uf[i]==uf[j]){
ma=max(ma,2+sqrt(dist(i,j)));
}
cout<<fixed<<setprecision(12)<<ma<<endl;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t=1; //cin>>t;
for(;t--;) solve();
}