結果

問題 No.96 圏外です。
ユーザー kosakkunkosakkun
提出日時 2016-11-29 18:41:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,112 bytes
コンパイル時間 896 ms
コンパイル使用メモリ 95,280 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-18 09:49:39
合計ジャッジ時間 21,192 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 16 ms
4,376 KB
testcase_05 AC 42 ms
4,376 KB
testcase_06 AC 101 ms
4,380 KB
testcase_07 AC 263 ms
4,380 KB
testcase_08 AC 466 ms
4,376 KB
testcase_09 AC 922 ms
4,380 KB
testcase_10 AC 2,746 ms
4,376 KB
testcase_11 AC 3,156 ms
4,376 KB
testcase_12 AC 3,993 ms
4,380 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <set>
#include <iomanip>
#include <deque>
#include <stdio.h>
using namespace std;

#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define RREP(i,n) for(int (i)=(int)(n)-1;i>=0;i--)
#define FOREACH(i,Itr) for(auto (i)=(Itr).begin();(i)!=(Itr).end();(i)++)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
#define UNIQUE(Itr) sort((Itr).begin(),(Itr).end()); (Itr).erase(unique((Itr).begin(),(Itr).end()),(Itr).end())
#define LBOUND(Itr,val) lower_bound((Itr).begin(),(Itr).end(),(val))
#define UBOUND(Itr,val) upper_bound((Itr).begin(),(Itr).end(),(val))
typedef long long ll;

class UnionFindFixed{
    vector<int> data;
public:
    UnionFindFixed(int size) : data(size, -1) { }
    bool unionSet(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool findSet(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};

int main(){
    
    int N; cin>>N;
    vector<int> X(N),Y(N);
    REP(i,N)cin>>X[i]>>Y[i];
    
    UnionFindFixed inst(130000);
    
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            double dist=sqrt((double)(abs(X[i]-X[j])*abs(X[i]-X[j]))+(double)(abs(Y[i]-Y[j])*abs(Y[i]-Y[j])));
            if(dist<=10.000001){
                inst.unionSet(i,j);
            }
        }
    }
    
    double ans=0;
    for(int i=0;i<N-1;i++){
        for(int j=i+1;j<N;j++){
            if(inst.findSet(i,j)){
                double dist=sqrt((double)(abs(X[i]-X[j])*abs(X[i]-X[j]))+(double)(abs(Y[i]-Y[j])*abs(Y[i]-Y[j])));
                ans=max(ans,dist);
            }
        }
    }
    
    cout<<fixed<<setprecision(10)<<ans+2.0<<endl;
    
    return 0;
}

0