結果

問題 No.94 圏外です。(EASY)
ユーザー pekempey
提出日時 2015-08-18 16:36:57
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 26 ms / 5,000 ms
コード長 1,499 bytes
コンパイル時間 1,611 ms
コンパイル使用メモリ 171,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 07:41:15
合計ジャッジ時間 2,524 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 22
権限があれば一括ダウンロードができます

ソースコード

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

#include <bits/stdc++.h>
#define rep(i, a) for (int i = 0; i < (a); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); i++)
#define repr(i, a) for (int i = (a) - 1; i >= 0; i--)
#define repr2(i, a, b) for (int i = (b) - 1; i >= (a); i--)
using namespace std;
typedef long long ll;
const ll inf = 1e9;
const ll mod = 1e9 + 7;
struct UF {
vector<int> parent, size;
UF(int n) : parent(n), size(n, 1) {
rep (i, n) parent[i] = i;
}
int root(int x) {
if (x == parent[x]) return x;
else return parent[x] = root(parent[x]);
}
void unite(int x, int y) {
x = root(x); y = root(y);
if (x == y) return;
if (size[x] > size[y]) swap(x, y);
size[x] += size[y];
parent[y] = x;
}
bool same(int x, int y) {
return root(x) == root(y);
}
};
typedef double D;
typedef complex<D> P;
const D eps = 1e-8;
D dot(P a, P b) {
return real(conj(a) * b);
}
D cross(P a, P b) {
return imag(conj(a) * b);
}
int N;
P ps[1000];
double G[1000][1000];
int main() {
int N;
cin >> N;
rep (i, N) {
double x, y;
cin >> x >> y;
ps[i] = P(x, y);
}
UF uf(N);
rep (i, N) rep (j, N) {
if (abs(ps[j] - ps[i]) <= 10) {
uf.unite(i, j);
}
}
map<int, vector<int>> group;
rep (i, N) {
group[uf.root(i)].push_back(i);
}
double ans = 1;
for (auto q : group) {
vector<int> p = q.second;
double dist = 0;
rep (i, p.size()) {
rep (j, p.size()) {
dist = max(dist, abs(ps[p[j]] - ps[p[i]]));
}
}
ans = max(ans, dist + 2);
}
printf("%.20f\n", ans);
return 0;
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
0