← Home
For problem statement at 0-999/0-99/70-79/79/problemB.txt this is a correct solution, but verifier at 0-999/0-99/70-79/79/verifierB.go ends with All tests passed! can you fix the verifier? ```go
package main

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

type Cell struct {
	x int
	y int
}

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

	var n, m, k, t int
	fmt.Fscan(in, &n, &m, &k, &t)

	wastes := make([]Cell, k)
	for i := 0; i < k; i++ {
		fmt.Fscan(in, &wastes[i].x, &wastes[i].y)
	}
	sort.Slice(wastes, func(i, j int) bool {
		if wastes[i].x != wastes[j].x {
			return wastes[i].x < wastes[j].x
		}
		return wastes[i].y < wastes[j].y
	})

	names := [3]string{"Carrots", "Kiwis", "Grapes"}

	for qi := 0; qi < t; qi++ {
		var i, j int
		fmt.Fscan(in, &i, &j)

		idx := sort.Search(len(wastes), func(p int) bool {
			if wastes[p].x != i {
				return wastes[p].x > i
			}
			return wastes[p].y >= j
		})

		if idx < len(wastes) && wastes[idx].x == i && wastes[idx].y == j {
			fmt.Fprintln(out, "Waste")
			continue
		}

		pos := int64(i-1)*int64(m) + int64(j)
		wBefore := sort.Search(len(wastes), func(p int) bool {
			if wastes[p].x != i {
				return wastes[p].x > i
			}
			return wastes[p].y >= j
		})
		cultIdx := pos - int64(wBefore) - 1
		fmt.Fprintln(out, names[cultIdx%3])
	}
}
```