結果

問題 No.94 圏外です。(EASY)
ユーザー kuuso1
提出日時 2014-12-07 21:12:01
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,664 bytes
コンパイル時間 882 ms
コンパイル使用メモリ 113,912 KB
実行使用メモリ 37,424 KB
最終ジャッジ日時 2024-06-11 17:17:51
合計ジャッジ時間 46,216 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21 WA * 1
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int INF=N*2;
		
		int[][] WF=new int[N][];
		for(int i=0;i<N;i++){
			WF[i]=new int[N];
			for(int j=0;j<N;j++){
				WF[i][j]=(X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j])<=100?1:INF;
			}
			WF[i][i]=0;
		}
		
		for(int k=0;k<N;k++){
			for(int i=0;i<N;i++){
				for(int j=i+1;j<N;j++){
					WF[i][j]=WF[j][i]=Math.Min(WF[i][j],WF[i][k]+WF[k][j]);
				}
			}
		}
		
		List<int> D=new List<int>();
		for(int i=0;i<N;i++){
			for(int j=i+1;j<N;j++){
				if(WF[i][j]!=INF)D.Add((X[i]-X[j])*(X[i]-X[j])+(Y[i]-Y[j])*(Y[i]-Y[j]));
			}
		}
		
		int max=0;
		for(int i=0;i<D.Count;i++){
			max=Math.Max(max,D[i]);
		}
		Console.WriteLine(2+Math.Sqrt(max));
		
		
	}
	int N;
	int[] X;
	int[] Y;
	public Sol(){
		N=ri();
		X=new int[N];
		Y=new int[N];
		for(int i=0;i<N;i++){
			var d=ria();
			X[i]=d[0];Y[i]=d[1];
		}
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0