← Home
For problem statement at 0-999/0-99/50-59/51/problemC.txt this is a correct solution, but verifier at 0-999/0-99/50-59/51/verifierC.go ends with All tests passed can you fix the verifier? package main

import (
	"fmt"
	"io"
	"os"
	"sort"
)

func main() {
	buf, _ := io.ReadAll(os.Stdin)
	var pos int
	readInt := func() int {
		for pos < len(buf) && (buf[pos] < '0' || buf[pos] > '9') {
			pos++
		}
		if pos >= len(buf) {
			return 0
		}
		res := 0
		for pos < len(buf) && buf[pos] >= '0' && buf[pos] <= '9' {
			res = res*10 + int(buf[pos]-'0')
			pos++
		}
		return res
	}

	n := readInt()
	if n == 0 {
		return
	}
	x := make([]int, n)
	for i := 0; i < n; i++ {
		x[i] = readInt()
	}

	sort.Ints(x)

	left := 0
	right := int(2e9)
	ans := right

	for left <= right {
		mid := left + (right-left)/2
		if check(x, mid) {
			ans = mid
			right = mid - 1
		} else {
			left = mid + 1
		}
	}

	d := float64(ans) / 2.0
	fmt.Printf("%.6f\n", d)

	p := make([]float64, 3)
	idx := 0
	p[0] = float64(x[idx]) + d
	for idx < n && x[idx] <= x[0]+ans {
		idx++
	}

	if idx < n {
		p[1] = float64(x[idx]) + d
		start2 := idx
		for idx < n && x[idx] <= x[start2]+ans {
			idx++
		}
		if idx < n {
			p[2] = float64(x[idx]) + d
		} else {
			p[2] = p[1]
		}
	} else {
		p[1] = p[0]
		p[2] = p[0]
	}

	fmt.Printf("%.6f %.6f %.6f\n", p[0], p[1], p[2])
}

func check(x []int, L int) bool {
	n := len(x)
	idx := 0
	for idx < n && x[idx] <= x[0]+L {
		idx++
	}
	if idx == n {
		return true
	}
	start2 := idx
	for idx < n && x[idx] <= x[start2]+L {
		idx++
	}
	if idx == n {
		return true
	}
	start3 := idx
	for idx < n && x[idx] <= x[start3]+L {
		idx++
	}
	return idx == n
}