← Home
For problem statement at 1000-1999/1900-1999/1980-1989/1985/problemD.txt this is a correct solution, but verifier at 1000-1999/1900-1999/1980-1989/1985/verifierD.go ends with test 1 failed
input:
1
1 1
#
expected:


got:
1 1


exit status 1 can you fix the verifier? package main

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

func main() {
	in := bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), 1<<20)
	in.Split(bufio.ScanWords)

	next := func() string {
		in.Scan()
		return in.Text()
	}

	nextInt := func() int {
		v, _ := strconv.Atoi(next())
		return v
	}

	t := nextInt()
	out := bufio.NewWriterSize(os.Stdout, 1<<20)
	defer out.Flush()

	for ; t > 0; t-- {
		n, m := nextInt(), nextInt()
		minR, minC := n+1, m+1
		maxR, maxC := 0, 0

		for i := 1; i <= n; i++ {
			s := next()
			for j := 1; j <= m; j++ {
				if s[j-1] == '#' {
					if i < minR {
						minR = i
					}
					if i > maxR {
						maxR = i
					}
					if j < minC {
						minC = j
					}
					if j > maxC {
						maxC = j
					}
				}
			}
		}

		fmt.Fprintln(out, (minR+maxR)/2, (minC+maxC)/2)
	}
}