← Home
For problem statement at 1000-1999/1300-1399/1310-1319/1311/problemE.txt this is a correct solution, but verifier at 1000-1999/1300-1399/1310-1319/1311/verifierE.go ends with All 100 tests passed can you fix the verifier? ```go
package main

import (
	"bufio"
	"io"
	"os"
	"strconv"
	"strings"
)

func minRel(rem, prev int) int {
	sum := 0
	depth := 1
	cap := prev
	for rem > 0 {
		x := cap * 2
		if x > rem {
			x = rem
		}
		sum += x * depth
		rem -= x
		cap = x
		depth++
	}
	return sum
}

func buildCounts(n, d int) ([]int, bool) {
	minT := minRel(n-1, 1)
	maxT := n * (n - 1) / 2
	if d < minT || d > maxT {
		return nil, false
	}

	counts := []int{1}
	rem := n - 1
	prev := 1
	target := d

	for rem > 0 {
		base := target - rem
		limit := prev * 2
		if limit > rem {
			limit = rem
		}
		chosen := 0
		for x := limit; x >= 1; x-- {
			s := rem - x
			mn := minRel(s, x)
			mx := s * (s + 1) / 2
			if base >= mn && base <= mx {
				chosen = x
				break
			}
		}
		if chosen == 0 {
			return nil, false
		}
		counts = append(counts, chosen)
		target = base
		rem -= chosen
		prev = chosen
	}

	if target != 0 {
		return nil, false
	}
	return counts, true
}

func main() {
	data, _ := io.ReadAll(os.Stdin)
	idx := 0
	nextInt := func() int {
		for idx < len(data) && (data[idx] < '0' || data[idx] > '9') {
			idx++
		}
		v := 0
		for idx < len(data) && data[idx] >= '0' && data[idx] <= '9' {
			v = v*10 + int(data[idx]-'0')
			idx++
		}
		return v
	}

	t := nextInt()
	var out strings.Builder

	for ; t > 0; t-- {
		n := nextInt()
		d := nextInt()

		counts, ok := buildCounts(n, d)
		if !ok {
			out.WriteString("NO\n")
			continue
		}

		parents := make([]int, n+1)
		prevLevel := []int{1}
		id := 2

		for depth := 1; depth < len(counts); depth++ {
			cnt := counts[depth]
			curLevel := make([]int, cnt)
			for i := 0; i < cnt; i++ {
				curLevel[i] = id
				parents[id] = prevLevel[i/2]
				id++
			}
			prevLevel = curLevel
		}

		out.WriteString("YES\n")
		for i := 2; i <= n; i++ {
			if i > 2 {
				out.WriteByte(' ')
			}
			out.WriteString(strconv.Itoa(parents[i]))
		}
		out.WriteByte('\n')
	}

	w := bufio.NewWriter(os.Stdout)
	w.WriteString(out.String())
	w.Flush()
}
```