← Home
For problem statement at 0-999/900-999/970-979/975/problemE.txt this is a correct solution, but verifier at 0-999/900-999/970-979/975/verifierE.go ends with case 1 failed: expected 0.00000000 -3.00000000
-0.36326129 -2.58720521
 got 0.0000000000 -3.0000000000
-3.2929567802 2.4684807263

input:
5 5
-1 5
0 1
-2 4
0 -3
1 0
2 4
1 1 4
1 4 2
1 2 2
2 3
exit status 1 can you fix the verifier? ```go
package main

import (
	"io"
	"math"
	"math/big"
	"os"
	"strconv"
)

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

	n := int(nextInt())
	q := int(nextInt())

	xi := make([]int64, n+1)
	yi := make([]int64, n+1)
	x := make([]float64, n+1)
	y := make([]float64, n+1)

	for i := 1; i <= n; i++ {
		xv := nextInt()
		yv := nextInt()
		xi[i] = xv
		yi[i] = yv
		x[i] = float64(xv)
		y[i] = float64(yv)
	}

	var area2, numX, numY big.Int
	var b1, b2, term big.Int

	for i := 1; i <= n; i++ {
		j := i + 1
		if j > n {
			j = 1
		}
		cross := xi[i]*yi[j] - xi[j]*yi[i]
		area2.Add(&area2, b1.SetInt64(cross))

		term.Mul(b1.SetInt64(cross), b2.SetInt64(xi[i]+xi[j]))
		numX.Add(&numX, &term)

		term.Mul(b1.SetInt64(cross), b2.SetInt64(yi[i]+yi[j]))
		numY.Add(&numY, &term)
	}

	var denom big.Int
	denom.Mul(&area2, big.NewInt(3))

	prec := uint(256)
	denF := new(big.Float).SetPrec(prec).SetInt(&denom)

	cxF := new(big.Float).SetPrec(prec).SetInt(&numX)
	cyF := new(big.Float).SetPrec(prec).SetInt(&numY)

	cxF.Quo(cxF, denF)
	cyF.Quo(cyF, denF)

	cx, _ := cxF.Float64()
	cy, _ := cyF.Float64()

	stableC := make([]float64, n+1)
	stableS := make([]float64, n+1)

	for i := 1; i <= n; i++ {
		ux := cx - x[i]
		uy := cy - y[i]
		r := math.Hypot(ux, uy)
		stableC[i] = -uy / r
		stableS[i] = -ux / r
	}

	curC, curS := 1.0, 0.0
	tx, ty := 0.0, 0.0
	p1, p2 := 1, 2

	out := make([]byte, 0, q*40)

	for ; q > 0; q-- {
		typ := int(nextInt())
		if typ == 1 {
			f := int(nextInt())
			t := int(nextInt())

			g := p1
			if p1 == f {
				g = p2
			}

			wgx := curC*x[g] - curS*y[g] + tx
			wgy := curS*x[g] + curC*y[g] + ty

			curC = stableC[g]
			curS = stableS[g]

			tx = wgx - (curC*x[g] - curS*y[g])
			ty = wgy - (curS*x[g] + curC*y[g])

			p1, p2 = g, t
		} else {
			v := int(nextInt())
			xv := curC*x[v] - curS*y[v] + tx
			yv := curS*x[v] + curC*y[v] + ty

			out = strconv.AppendFloat(out, xv, 'f', 10, 64)
			out = append(out, ' ')
			out = strconv.AppendFloat(out, yv, 'f', 10, 64)
			out = append(out, '\n')
		}
	}

	os.Stdout.Write(out)
}
```