結果

問題 No.94 圏外です。(EASY)
ユーザー srup٩(๑`н´๑)۶
提出日時 2016-08-07 21:42:36
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 7 ms / 5,000 ms
コード長 1,920 bytes
コンパイル時間 664 ms
コンパイル使用メモリ 71,304 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 08:01:13
合計ジャッジ時間 1,538 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

diff #
プレゼンテーションモードにする

#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
class DisjointSet{
public:
vector<int> rank, p;//rank: p:
DisjointSet(){}
DisjointSet(int size){//
rank.resize(size, 0);
p.resize(size, 0);
rep(i, size) makeSet(i);
}
void makeSet(int x){
p[x] = x;
rank[x] = 0;
}
//使
bool same(int x, int y){
return findSet(x) == findSet(y);
}
//
void unite(int x, int y){
link(findSet(x), findSet(y));
}
//
void link(int x, int y){
if(rank[x] > rank[y]){
p[y] = x;
}else{
p[x] = y;
if(rank[x] == rank[y]) rank[y]++;
}
}
//
int findSet(int x){
if(x != p[x]){
p[x] = findSet(p[x]);
}
return p[x];
}
};
int main(void){
int n; cin >> n;
if(n == 0){
printf("1\n"); return 0;
}
vector<int> x(n);
vector<int> y(n);
rep(i, n) cin >> x[i] >> y[i];
DisjointSet ds = DisjointSet(n);
double now;
for (int i = 0; i < n; ++i){
for (int j = 0; j < n; ++j){
now = (x[j] - x[i]) * (x[j] - x[i])
+ (y[j] - y[i]) * (y[j] - y[i]);
if(now <= 100){
ds.unite(i, j);
}
}
}
double ans = 0;
for (int i = 0; i < n; ++i){
for (int j = i + 1; j < n; ++j){
if(ds.same(i, j)){
now = (x[j] - x[i]) * (x[j] - x[i])+ (y[j] - y[i]) * (y[j] - y[i]);
ans = max(ans, now);
}
}
}
printf("%f\n", sqrt(ans) + 2.0);
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0