← Home
For problem statement at 0-999/0-99/40-49/46/problemG.txt this is a correct solution, but verifier at 0-999/0-99/40-49/46/verifierG.go ends with case n=4 failed: user max length 25 > expected 5
exit status 1 can you fix the verifier? ```go
package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	var n int
	if _, err := fmt.Fscan(in, &n); err != nil {
		return
	}

	// Small cases
	if n == 3 {
		fmt.Fprintln(out, "YES")
		fmt.Fprintln(out, "0 0")
		fmt.Fprintln(out, "1 0")
		fmt.Fprintln(out, "0 2")
		return
	}
	if n == 4 {
		fmt.Fprintln(out, "YES")
		fmt.Fprintln(out, "0 0")
		fmt.Fprintln(out, "1 0")
		fmt.Fprintln(out, "2 2")
		fmt.Fprintln(out, "0 5")
		return
	}

	// Base construction parameters
	M := 2 * ((n - 2) / 3)
	if M < 2 {
		M = 2
	}
	baseCount := (3*M)/2 + 2
	rem := n - baseCount // 0..2

	H := int64(400000000) // even, large enough and within bounds

	type P struct{ x, y int64 }
	pts := make([]P, 0, n)

	// Left vertical, start at bottom
	y := -H
	pts = append(pts, P{0, y}) // L0

	// Insert up to rem internal points on left vertical with distinct lengths 1,2,...
	S := rem + 1
	var sumPrev int64 = 0
	for i := 1; i <= S-1; i++ {
		d := int64(i)
		sumPrev += d
		y += d
		pts = append(pts, P{0, y})
	}
	// Next edge to U0 will have length 2H - sumPrev automatically

	// Upper chain: U_i = (i, H - i^2), i=0..M
	for i := 0; i <= M; i++ {
		xi := int64(i)
		yi := H - int64(i*i)
		pts = append(pts, P{xi, yi})
	}

	// Right vertical down to L_{M/2} = (M, -H + M^2)
	rmY := -H + int64(M*M)
	pts = append(pts, P{int64(M), rmY})

	// Lower chain back towards left: (2j, -H + (2j)^2), j=M/2-1..1
	for j := M/2 - 1; j >= 1; j-- {
		xj := int64(2 * j)
		yj := -H + int64((2*j)*(2*j))
		pts = append(pts, P{xj, yj})
	}

	// Ensure correct count
	if len(pts) != n {
		// Fallback should not happen; but if off due to arithmetic, adjust by trimming or simple fix
		// For safety, in rare case, append L1 if missing and possible
		for len(pts) < n && M >= 2 {
			pts = append(pts, P{int64(2), -H + 4})
		}
		for len(pts) > n {
			pts = pts[:len(pts)-1]
		}
	}

	fmt.Fprintln(out, "YES")
	for _, p := range pts {
		fmt.Fprintf(out, "%d %d\n", p.x, p.y)
	}
}
```