結果

問題 No.94 圏外です。(EASY)
ユーザー beetbeet
提出日時 2018-11-17 00:22:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 1,209 bytes
コンパイル時間 2,842 ms
コンパイル使用メモリ 202,928 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-26 01:36:57
合計ジャッジ時間 3,695 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,384 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 5 ms
4,380 KB
testcase_09 AC 9 ms
4,376 KB
testcase_10 AC 9 ms
4,380 KB
testcase_11 AC 9 ms
4,376 KB
testcase_12 AC 9 ms
4,380 KB
testcase_13 AC 9 ms
4,380 KB
testcase_14 AC 9 ms
4,376 KB
testcase_15 AC 9 ms
4,380 KB
testcase_16 AC 9 ms
4,380 KB
testcase_17 AC 9 ms
4,380 KB
testcase_18 AC 10 ms
4,380 KB
testcase_19 AC 9 ms
4,380 KB
testcase_20 AC 2 ms
4,380 KB
testcase_21 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


struct UnionFind{
  Int n;
  vector<Int> r,p;
  UnionFind(){}
  UnionFind(Int sz):n(sz),r(sz,1),p(sz,0){iota(p.begin(),p.end(),0);}
  Int find(Int x){
    return (x==p[x]?x:p[x]=find(p[x]));
  }
  bool same(Int x,Int y){
    return find(x)==find(y);
  }
  void unite(Int x,Int y){
    x=find(x);y=find(y);
    if(x==y) return;
    if(r[x]<r[y]) swap(x,y);
    r[x]+=r[y];
    p[y]=x;
  }
};


struct Precision{
  Precision(){
    cout<<fixed<<setprecision(12);
  }
}precision_beet;

//INSERT ABOVE HERE
signed main(){
  Int n;
  cin>>n;
  vector<Int> x(n),y(n);
  for(Int i=0;i<n;i++) cin>>x[i]>>y[i];
  UnionFind uf(n);
  auto l2norm=[&](Int i,Int j){
                return (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);};
  for(Int i=0;i<n;i++)
    for(Int j=0;j<n;j++)
      if(l2norm(i,j)<=100) uf.unite(i,j);

  double ans=1;  
  for(Int i=0;i<n;i++)
    for(Int j=0;j<n;j++)
      if(uf.same(i,j)) chmax(ans,sqrt(double(l2norm(i,j)))+2.0);

  cout<<ans<<endl;
  return 0;
}
0