← Home
For problem statement at 1000-1999/1700-1799/1700-1709/1704/problemD.txt this is a correct solution, but verifier at 1000-1999/1700-1799/1700-1709/1704/verifierD.go ends with case 1 failed: expected 1 20 got 1 18446744073709551597

exit status 1 can you fix the verifier? package main

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

func main() {
	input, _ := io.ReadAll(os.Stdin)
	var pos int

	nextInt := func() uint64 {
		for pos < len(input) && (input[pos] < '0' || input[pos] > '9') {
			pos++
		}
		if pos >= len(input) {
			return 0
		}
		var res uint64
		for pos < len(input) && input[pos] >= '0' && input[pos] <= '9' {
			res = res*10 + uint64(input[pos]-'0')
			pos++
		}
		return res
	}

	for pos < len(input) && (input[pos] < '0' || input[pos] > '9') {
		pos++
	}
	if pos >= len(input) {
		return
	}

	t := int(nextInt())
	if t == 0 {
		return
	}

	out := bufio.NewWriter(os.Stdout)
	defer out.Flush()

	for tc := 0; tc < t; tc++ {
		n := int(nextInt())
		m := int(nextInt())

		sums := make([]uint64, n)
		for i := 0; i < n; i++ {
			var s uint64 = 0
			for j := 1; j <= m; j++ {
				v := nextInt()
				s += uint64(j) * v
			}
			sums[i] = s
		}

		var base uint64
		if sums[0] == sums[1] {
			base = sums[0]
		} else if sums[0] == sums[2] {
			base = sums[0]
		} else {
			base = sums[1]
		}

		for i := 0; i < n; i++ {
			if sums[i] != base {
				fmt.Fprintf(out, "%d %d\n", i+1, sums[i]-base)
				break
			}
		}
	}
}