← Home
For problem statement at 0-999/600-699/620-629/623/problemD.txt this is a correct solution, but verifier at 0-999/600-699/620-629/623/verifierD.go ends with  can you fix the verifier? ```go
package main

import (
	"bufio"
	"container/heap"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type Item struct {
	g     float64
	index int
}

type MaxHeap []Item

func (h MaxHeap) Len() int           { return len(h) }
func (h MaxHeap) Less(i, j int) bool { return h[i].g > h[j].g }
func (h MaxHeap) Swap(i, j int)      { h[i], h[j] = h[j], h[i] }

func (h *MaxHeap) Push(x interface{}) {
	*h = append(*h, x.(Item))
}

func (h *MaxHeap) Pop() interface{} {
	old := *h
	n := len(old)
	x := old[n-1]
	*h = old[0 : n-1]
	return x
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Scan()
	n, _ := strconv.Atoi(scanner.Text())
	scanner.Scan()
	line := strings.Fields(scanner.Text())
	p := make([]float64, n)
	for i := 0; i < n; i++ {
		val, _ := strconv.Atoi(line[i])
		p[i] = float64(val) / 100.0
	}

	if n == 1 {
		fmt.Println("1.0")
		return
	}

	prob := make([]float64, n)
	q := make([]float64, n)
	for i := 0; i < n; i++ {
		prob[i] = p[i]
		q[i] = 1.0 - prob[i]
	}

	q_pow := make([]float64, n)
	curr_g := make([]float64, n)
	f := 1.0
	for i := 0; i < n; i++ {
		q_pow[i] = q[i]
		curr_g[i] = q[i]
		f *= prob[i]
	}

	sum := float64(n) + (1.0 - f)

	h := &MaxHeap{}
	heap.Init(h)
	for i := 0; i < n; i++ {
		heap.Push(h, Item{g: curr_g[i], index: i})
	}

	for {
		var item Item
		for {
			item = heap.Pop(h).(Item)
			if item.g == curr_g[item.index] {
				break
			}
		}
		i := item.index
		old_g := item.g

		q_pow[i] *= q[i]
		new_g := prob[i] * q_pow[i] / (1.0 - q_pow[i])
		curr_g[i] = new_g

		f *= (1.0 + old_g)
		sum += (1.0 - f)

		if 1.0-f < 1e-16 {
			break
		}

		heap.Push(h, Item{g: new_g, index: i})
	}

	fmt.Printf("%.10f\n", sum)
}
```