結果
| 問題 |
No.96 圏外です。
|
| コンテスト | |
| ユーザー |
kosakkun
|
| 提出日時 | 2016-11-29 18:44:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 2,210 bytes |
| コンパイル時間 | 887 ms |
| コンパイル使用メモリ | 97,220 KB |
| 実行使用メモリ | 10,624 KB |
| 最終ジャッジ日時 | 2024-11-27 13:46:35 |
| 合計ジャッジ時間 | 96,777 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 1 TLE * 14 |
ソースコード
#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;
if(N==0){
cout<<fixed<<setprecision(10)<<2.0<<endl;
return 0;
}
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;
}
kosakkun