結果

問題 No.94 圏外です。(EASY)
ユーザー harurunharurun
提出日時 2022-06-29 18:18:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 4 ms / 5,000 ms
コード長 1,751 bytes
コンパイル時間 3,910 ms
コンパイル使用メモリ 192,736 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-02 09:16:54
合計ジャッジ時間 4,291 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <queue>
#include <string>
#include <iomanip>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <utility>
#include <stack>
#include <random>
#include <complex>
#include <functional>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <assert.h>
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
using namespace std;
using ll=long long;
#define read(x) cin>>(x);
#define readll(x) ll (x);cin>>(x);
#define readS(x) string (x);cin>>(x);
#define readvll(x,N) vector<ll> (x)((N));for(int i=0;i<(N);i++){cin>>(x)[i];}
#define rep(i,N) for(ll (i)=0;(i)<(N);(i)++)
#define rep2d(i,j,H,W) for(ll (i)=0;(i)<(H);(i)++)for(ll (j)=0;(j)<(W);j++)
#define is_in(x,y) (0<=(x) && (x)<H && 0<=(y) && (y)<W)
#define yn {cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define double_out(x) fixed << setprecision(x)
inline ll powll(ll x,ll n){ll r=1;while(n>0){if(n&1){r*=x;};x*=x;n>>=1;};return r;}

int main(){
  ll N;
  cin>>N;
  if(N==0){
    cout<<1.0<<endl;
    return 0;
  }
  atcoder::dsu uf(N);
  vector<pair<ll,ll>> d(N);
  for(auto& i:d){
    cin>>i.first>>i.second;
  }
  for(ll i=0;i<N;i++){
    for(ll j=i+1;j<N;j++){
      if(powll(d[i].first-d[j].first,2)+powll(d[i].second-d[j].second,2)<=100){
        uf.merge(i,j);
      }
    }
  }
  double ans=0.0;
  vector<vector<int>> grps=uf.groups();
  for(vector<int>& i:grps){
    for(unsigned j=0;j<i.size();j++){
      for(unsigned k=j+1;k<i.size();k++){
        ans=max(ans,sqrt(powll(d[i[j]].first-d[i[k]].first,2)+powll(d[i[j]].second-d[i[k]].second,2)));
      }
    }
  }
  cout<<double_out(10)<<ans+2.0<<endl;
}
0