← Home
For problem statement at 1000-1999/1400-1499/1400-1409/1409/problemC.txt this is a correct solution, but verifier at 1000-1999/1400-1499/1400-1409/1409/verifierC.go ends with All tests passed can you fix the verifier? package main

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

func main() {
	in := bufio.NewReaderSize(os.Stdin, 1<<20)
	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	var t int
	fmt.Fscan(in, &t)

	for ; t > 0; t-- {
		var n, x, y int
		fmt.Fscan(in, &n, &x, &y)

		bestMax := int(1e18)
		var best []int

		for d := 1; d <= y-x; d++ {
			if (y-x)%d != 0 {
				continue
			}
			if (y-x)/d+1 > n {
				continue
			}

			tmp := []int{y}
			cur := y
			for len(tmp) < n && cur-d > 0 {
				cur -= d
				tmp = append(tmp, cur)
			}

			arr := make([]int, 0, n)
			for i := len(tmp) - 1; i >= 0; i-- {
				arr = append(arr, tmp[i])
			}

			cur = y
			for len(arr) < n {
				cur += d
				arr = append(arr, cur)
			}

			maxVal := arr[len(arr)-1]
			if maxVal < bestMax {
				bestMax = maxVal
				best = arr
			}
		}

		for i, v := range best {
			if i > 0 {
				fmt.Fprint(out, " ")
			}
			fmt.Fprint(out, v)
		}
		fmt.Fprintln(out)
	}
}