結果

問題 No.94 圏外です。(EASY)
ユーザー naimonon77naimonon77
提出日時 2016-09-25 18:22:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,549 bytes
コンパイル時間 1,705 ms
コンパイル使用メモリ 169,628 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-04-29 10:02:37
合計ジャッジ時間 2,847 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 5 ms
7,168 KB
testcase_04 AC 5 ms
7,424 KB
testcase_05 AC 6 ms
7,552 KB
testcase_06 AC 8 ms
7,424 KB
testcase_07 AC 12 ms
7,424 KB
testcase_08 AC 18 ms
7,552 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 30 ms
7,424 KB
testcase_12 AC 32 ms
7,552 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 32 ms
7,424 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unite(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 same(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 N;
double x[1005], y[1005];

void solve() {
	UnionFind uf((int)1e6);
	double ans = 0;
	rep(i, N) {
		cin >> x[i] >> y[i];
	}
	rep(i, N) rep(j, N) {
		if (hypot(x[i] - x[j], y[i] - y[j]) - 1e-6 < 10) {
			uf.unite(i, j);
		}
		// dump(hypot(x[i] - x[j], y[i] - y[j]));
	}
	rep(i, N) rep(j, N) {
		if (uf.same(i, j)) {
			ans = max(ans, hypot(x[i] - x[j], y[i] - y[j]));
		}
	}
	if (ans == 0) puts("1");
	else {
		ans += 2;
		cout << ans << endl;
	}
}

signed main() {
	while (cin >> N) {
		solve();
	}
	return 0;
}
0