For problem statement at 1000-1999/1000-1099/1050-1059/1059/problemB.txt this is a correct solution, but verifier at 1000-1999/1000-1099/1050-1059/1059/verifierB.go ends with test 1: runtime error: exit status 2
panic: runtime error: index out of range [0] with length 0
goroutine 1 [running]:
main.main()
/tmp/build-3718946457/solution.go:35 +0x548
input:
3 3
###
###
###
exit status 1 can you fix the verifier? ```go
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
reader := bufio.NewReader(os.Stdin)
var n, m int
fmt.Fscan(reader, &n, &m)
grid := make([][]byte, n)
for i := 0; i < n; i++ {
line, _ := reader.ReadString('\n')
line = strings.TrimSpace(line)
grid[i] = []byte(line)
}
c := make([][]bool, n)
for i := 0; i < n; i++ {
c[i] = make([]bool, m)
}
for i := 1; i < n-1; i++ {
for j := 1; j < m-1; j++ {
allHash := true
check:
for dx := -1; dx <= 1; dx++ {
for dy := -1; dy <= 1; dy++ {
if dx == 0 && dy == 0 {
continue
}
ni := i + dx
nj := j + dy
if grid[ni][nj] != '#' {
allHash = false
break check
}
}
}
if allHash {
c[i][j] = true
}
}
}
possible := true
for i := 0; i < n; i++ {
for j := 0; j < m; j++ {
if grid[i][j] == '#' {
has := false
checkhas:
for dx := -1; dx <= 1; dx++ {
for dy := -1; dy <= 1; dy++ {
if dx == 0 && dy == 0 {
continue
}
ni := i + dx
nj := j + dy
if ni >= 0 && ni < n && nj >= 0 && nj < m && c[ni][nj] {
has = true
break checkhas
}
}
}
if !has {
possible = false
break
}
}
}
if !possible {
break
}
}
if possible {
fmt.Println("YES")
} else {
fmt.Println("NO")
}
}
```