結果

問題 No.94 圏外です。(EASY)
ユーザー fiordfiord
提出日時 2015-08-10 00:00:13
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 773 bytes
コンパイル時間 1,158 ms
コンパイル使用メモリ 145,440 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-25 07:46:43
合計ジャッジ時間 3,792 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 WA -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int group[10];
int calc(int x,int y){
	return x*x+y*y;
}
int find(int x){
	if(group[x]==x)	return x;
	group[x]=find(group[x]);
	return group[x];
}
void merge(int i,int j){
	group[i]=find(group[j]);
}
int main(){
	for(int i=0;i<10;i++)	group[i]=i;
	int n;	cin>>n;
	int x[n],y[n];
	for(int i=0;i<n;i++)	cin>>x[i]>>y[i];
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(calc(x[i]-x[j],y[i]-y[j])<=100){
				merge(i,j);
			}
		}
	}
	for(int i=0;i<n;i++)	group[i]=find(group[i]);
	int longest=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			if(group[i]==group[j]){
				longest=max(longest,calc(x[i]-x[j],y[i]-y[j]));
			}
		}
	}
	if(longest==0)	cout<<1<<endl;
	else printf("%.15lf\n",(double)sqrt(longest)+2);
	return 0;
}
0