← Home
For problem statement at 1000-1999/1100-1199/1180-1189/1185/problemF.txt this is a correct solution, but verifier at 1000-1999/1100-1199/1180-1189/1185/verifierF.go ends with All 100 tests passed can you fix the verifier? ```go
package main

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

type Pizza struct {
	cost int64
	id   int
}

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	res := 0
	for _, b := range scanner.Bytes() {
		res = res*10 + int(b-'0')
	}
	return res
}

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1024*1024), 10*1024*1024)

	if !scanner.Scan() {
		return
	}
	n := 0
	for _, b := range scanner.Bytes() {
		n = n*10 + int(b-'0')
	}
	m := nextInt(scanner)

	reqCount := make([]int, 512)
	for i := 0; i < n; i++ {
		f := nextInt(scanner)
		mask := 0
		for j := 0; j < f; j++ {
			x := nextInt(scanner)
			mask |= 1 << (x - 1)
		}
		reqCount[mask]++
	}

	satisfied := make([]int, 512)
	for U := 0; U < 512; U++ {
		for req := 0; req < 512; req++ {
			if (req & U) == req {
				satisfied[U] += reqCount[req]
			}
		}
	}

	bestPizza := make([]Pizza, 512)
	secondPizza := make([]Pizza, 512)
	for i := 0; i < 512; i++ {
		bestPizza[i] = Pizza{cost: 3e18, id: -1}
		secondPizza[i] = Pizza{cost: 3e18, id: -1}
	}

	for j := 1; j <= m; j++ {
		c := int64(nextInt(scanner))
		r := nextInt(scanner)
		mask := 0
		for k := 0; k < r; k++ {
			x := nextInt(scanner)
			mask |= 1 << (x - 1)
		}

		if c < bestPizza[mask].cost {
			secondPizza[mask] = bestPizza[mask]
			bestPizza[mask] = Pizza{cost: c, id: j}
		} else if c < secondPizza[mask].cost {
			secondPizza[mask] = Pizza{cost: c, id: j}
		}
	}

	maxSat := -1
	var minCost int64 = 3e18
	ans1, ans2 := -1, -1

	for mask1 := 0; mask1 < 512; mask1++ {
		if bestPizza[mask1].id == -1 {
			continue
		}
		for mask2 := mask1; mask2 < 512; mask2++ {
			if mask1 == mask2 {
				if secondPizza[mask1].id == -1 {
					continue
				}
				U := mask1 | mask2
				sat := satisfied[U]
				cost := bestPizza[mask1].cost + secondPizza[mask1].cost
				if sat > maxSat || (sat == maxSat && cost < minCost) {
					maxSat = sat
					minCost = cost
					ans1 = bestPizza[mask1].id
					ans2 = secondPizza[mask1].id
				}
			} else {
				if bestPizza[mask2].id == -1 {
					continue
				}
				U := mask1 | mask2
				sat := satisfied[U]
				cost := bestPizza[mask1].cost + bestPizza[mask2].cost
				if sat > maxSat || (sat == maxSat && cost < minCost) {
					maxSat = sat
					minCost = cost
					ans1 = bestPizza[mask1].id
					ans2 = bestPizza[mask2].id
				}
			}
		}
	}

	fmt.Printf("%d %d\n", ans1, ans2)
}
```