← Home
For problem statement at 0-999/100-199/100-109/106/problemE.txt this is a correct solution, but verifier at 0-999/100-199/100-109/106/verifierE.go ends with case 1 failed: center/radius mismatch
exit status 1 can you fix the verifier? ```go
package main

import (
	"fmt"
	"math"
)

type Point struct {
	x, y, z float64
}

func dist(a, b Point) float64 {
	dx := a.x - b.x
	dy := a.y - b.y
	dz := a.z - b.z
	return math.Sqrt(dx*dx + dy*dy + dz*dz)
}

func maxDist(p Point, points []Point) float64 {
	max := 0.0
	for _, q := range points {
		d := dist(p, q)
		if d > max {
			max = d
		}
	}
	return max
}

func main() {
	var n int
	fmt.Scan(&n)
	
	points := make([]Point, n)
	var sx, sy, sz float64
	
	for i := 0; i < n; i++ {
		var x, y, z float64
		fmt.Scan(&x, &y, &z)
		points[i] = Point{x, y, z}
		sx += x
		sy += y
		sz += z
	}
	
	cur := Point{sx / float64(n), sy / float64(n), sz / float64(n)}
	
	minX, maxX := points[0].x, points[0].x
	for _, p := range points[1:] {
		if p.x < minX {
			minX = p.x
		}
		if p.x > maxX {
			maxX = p.x
		}
	}
	step := maxX - minX
	if step < 1 {
		step = 1
	}
	
	var dirs []Point
	for dx := -1; dx <= 1; dx++ {
		for dy := -1; dy <= 1; dy++ {
			for dz := -1; dz <= 1; dz++ {
				if dx == 0 && dy == 0 && dz == 0 {
					continue
				}
				l := math.Sqrt(float64(dx*dx + dy*dy + dz*dz))
				dirs = append(dirs, Point{float64(dx) / l, float64(dy) / l, float64(dz) / l})
			}
		}
	}
	
	for step > 1e-8 {
		improved := false
		curVal := maxDist(cur, points)
		
		for _, d := range dirs {
			next := Point{
				cur.x + d.x*step,
				cur.y + d.y*step,
				cur.z + d.z*step,
			}
			nextVal := maxDist(next, points)
			if nextVal < curVal {
				cur = next
				curVal = nextVal
				improved = true
			}
		}
		
		if !improved {
			step *= 0.5
		}
	}
	
	fmt.Printf("%.10f %.10f %.10f\n", cur.x, cur.y, cur.z)
}
```