← Home
For problem statement at 1000-1999/1900-1999/1930-1939/1936/problemF.txt this is a correct solution, but verifier at 1000-1999/1900-1999/1930-1939/1936/verifierF.go ends with case 2 failed: expected 1.651629 2.632490 0.426552 got 1.651629364 2.632490098 -0.426551835
input:
2
1.068 2.536 0.165
3.433 2.927 1.379
exit status 1 can you fix the verifier? ```go
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
)

func main() {
	reader := bufio.NewReader(os.Stdin)
	var n int
	if _, err := fmt.Fscan(reader, &n); err != nil {
		return
	}

	cx := make([]float64, n)
	cy := make([]float64, n)
	cr := make([]float64, n)

	for i := 0; i < n; i++ {
		fmt.Fscan(reader, &cx[i], &cy[i], &cr[i])
	}

	x, y := cx[0], cy[0]
	step := 2e6

	iters := 400000000 / n
	if iters > 50000 {
		iters = 50000
	}
	if iters < 4000 {
		iters = 4000
	}

	decay := math.Pow(1e-10/step, 1.0/float64(iters))

	bestX, bestY := x, y
	bestVal := -1e18

	for iter := 0; iter < iters; iter++ {
		minVal := 1e18
		minI := 0
		for i := 0; i < n; i++ {
			dx := x - cx[i]
			dy := y - cy[i]
			d := math.Sqrt(dx*dx + dy*dy)
			val := cr[i] - d
			if val < minVal {
				minVal = val
				minI = i
			}
		}

		if minVal > bestVal {
			bestVal = minVal
			bestX = x
			bestY = y
		}

		dx := cx[minI] - x
		dy := cy[minI] - y
		d := math.Sqrt(dx*dx + dy*dy)
		if d > 1e-12 {
			x += step * dx / d
			y += step * dy / d
		}
		step *= decay
	}

	fmt.Printf("%.9f %.9f %.9f\n", bestX, bestY, bestVal)
}
```