← 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 dist2(p1, p2 Point) float64 {
	dx := p1.x - p2.x
	dy := p1.y - p2.y
	dz := p1.z - p2.z
	return dx*dx + dy*dy + dz*dz
}

func maxDist2(c Point, points []Point) float64 {
	maxd := 0.0
	for _, p := range points {
		d := dist2(c, p)
		if d > maxd {
			maxd = d
		}
	}
	return maxd
}

func main() {
	var n int
	fmt.Scan(&n)
	
	points := make([]Point, n)
	var cx, cy, cz float64
	minX, minY, minZ := math.MaxFloat64, math.MaxFloat64, math.MaxFloat64
	maxX, maxY, maxZ := -math.MaxFloat64, -math.MaxFloat64, -math.MaxFloat64
	
	for i := 0; i < n; i++ {
		var x, y, z float64
		fmt.Scan(&x, &y, &z)
		points[i] = Point{x, y, z}
		cx += x
		cy += y
		cz += z
		
		if x < minX { minX = x }
		if x > maxX { maxX = x }
		if y < minY { minY = y }
		if y > maxY { maxY = y }
		if z < minZ { minZ = z }
		if z > maxZ { maxZ = z }
	}
	
	cx /= float64(n)
	cy /= float64(n)
	cz /= float64(n)
	
	step := maxX - minX
	if dy := maxY - minY; dy > step { step = dy }
	if dz := maxZ - minZ; dz > step { step = dz }
	if step < 1.0 { step = 1.0 }
	
	cur := Point{cx, cy, cz}
	curDist2 := maxDist2(cur, points)
	
	directions := []Point{
		{1, 0, 0}, {-1, 0, 0},
		{0, 1, 0}, {0, -1, 0},
		{0, 0, 1}, {0, 0, -1},
	}
	
	for step > 1e-8 {
		improved := false
		for _, dir := range directions {
			next := Point{
				cur.x + dir.x*step,
				cur.y + dir.y*step,
				cur.z + dir.z*step,
			}
			nextDist2 := maxDist2(next, points)
			if nextDist2 < curDist2 {
				curDist2 = nextDist2
				cur = next
				improved = true
			}
		}
		if !improved {
			step *= 0.5
		}
	}
	
	fmt.Printf("%.10f %.10f %.10f\n", cur.x, cur.y, cur.z)
}
```