結果
問題 | No.94 圏外です。(EASY) |
ユーザー |
|
提出日時 | 2014-12-07 19:53:35 |
言語 | Go (1.23.4) |
結果 |
AC
|
実行時間 | 15 ms / 5,000 ms |
コード長 | 810 bytes |
コンパイル時間 | 12,145 ms |
コンパイル使用メモリ | 238,128 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 07:19:34 |
合計ジャッジ時間 | 13,188 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
ソースコード
package main import ( "fmt" "math" ) func norm(x, y int) int { return x*x + y*y } var res []int func dfs(u int, used []bool, x, y []int) { if used[u] { return } res = append(res, u) used[u] = true for i, _ := range x { if norm(x[i]-x[u], y[i]-y[u]) <= 100 { dfs(i, used, x, y) } } } func main() { var n int fmt.Scan(&n) x := make([]int, n) y := make([]int, n) for i, _ := range x { fmt.Scan(&x[i], &y[i]) } used := make([]bool, n) ans := 1.0 for i, v := range used { if !v { res = make([]int, 0) dfs(i, used, x, y) for _, u := range res { for _, v := range res { d := 2 + math.Sqrt(float64(norm(x[u]-x[v], y[u]-y[v]))) if ans < d { ans = d } } } } } fmt.Printf("%.12f\n", ans) }