← Home
For problem statement at 0-999/400-499/490-499/492/problemE.txt this is a correct solution, but verifier at 0-999/400-499/490-499/492/verifierE.go ends with case 1 failed: expected 0 4 got 1 1
input:
5 16 4 3
1 1
0 1
1 1
0 4
2 3
2 4
1 4
3 4
1 2
0 3
0 1
2 1
3 3
2 3
2 2
1 3
exit status 1 can you fix the verifier? package main

import (
	"fmt"
	"os"
)

func main() {
	buf := make([]byte, 8192)
	var pos, total int
	nextChar := func() byte {
		if pos >= total {
			var err error
			total, err = os.Stdin.Read(buf)
			if err != nil || total == 0 {
				return 0
			}
			pos = 0
		}
		b := buf[pos]
		pos++
		return b
	}

	nextInt := func() int64 {
		b := nextChar()
		for b <= ' ' && b != 0 {
			b = nextChar()
		}
		if b == 0 {
			return 0
		}
		var res int64
		for b > ' ' {
			res = res*10 + int64(b-'0')
			b = nextChar()
		}
		return res
	}

	n := nextInt()
	if n == 0 {
		return
	}
	m := int(nextInt())
	dx := nextInt()
	dy := nextInt()

	count := make([]int, n)
	firstX := make([]int64, n)
	firstY := make([]int64, n)

	var maxC int64 = 0
	var maxCount int = -1

	for i := 0; i < m; i++ {
		x := nextInt()
		y := nextInt()

		c := (y*dx - x*dy) % n
		if c < 0 {
			c += n
		}

		if count[c] == 0 {
			firstX[c] = x
			firstY[c] = y
		}
		count[c]++

		if count[c] > maxCount {
			maxCount = count[c]
			maxC = c
		}
	}

	fmt.Printf("%d %d\n", firstX[maxC], firstY[maxC])
}