For problem statement at 0-999/500-599/540-549/549/problemB.txt this is a correct solution, but verifier at 0-999/500-599/540-549/549/verifierB.go ends with case 1 failed: expected "1\n5" got "1\n1"
input:
5
11001
01000
11111
00011
10001
2 4 2 1 0
exit status 1 can you fix the verifier? ```go
package main
import (
"bufio"
"fmt"
"math/bits"
"os"
"strconv"
"strings"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanLines)
scanner.Scan()
n, _ := strconv.Atoi(scanner.Text())
col := make([][2]uint64, n)
for i := 0; i < n; i++ {
scanner.Scan()
s := scanner.Text()
for j := 0; j < n; j++ {
if s[j] == '1' {
if i < 64 {
col[j][0] |= 1 << uint(i)
} else {
col[j][1] |= 1 << uint(i-64)
}
}
}
}
scanner.Scan()
parts := strings.Fields(scanner.Text())
a := make([]int, n)
for i := 0; i < n; i++ {
a[i], _ = strconv.Atoi(parts[i])
}
found := false
var result []int
check := func(indices []int) bool {
var s [2]uint64
for _, idx := range indices {
if idx < 64 {
s[0] |= 1 << uint(idx)
} else {
s[1] |= 1 << uint(idx-64)
}
}
for j := 0; j < n; j++ {
cnt := bits.OnesCount64(s[0]&col[j][0]) + bits.OnesCount64(s[1]&col[j][1])
if cnt == a[j] {
return false
}
}
return true
}
var dfs func(start, k int, curr []int)
dfs = func(start, k int, curr []int) {
if found {
return
}
if k == 0 {
if check(curr) {
result = make([]int, len(curr))
copy(result, curr)
found = true
}
return
}
for i := start; i <= n-k; i++ {
dfs(i+1, k-1, append(curr, i))
}
}
for k := 0; k <= 4 && k <= n; k++ {
dfs(0, k, []int{})
if found {
break
}
}
if !found {
for k := 0; k <= 4 && k <= n; k++ {
size := n - k
if size < 0 {
continue
}
dfs(0, size, []int{})
if found {
break
}
}
}
if found {
fmt.Println(len(result))
for i, v := range result {
if i > 0 {
fmt.Print(" ")
}
fmt.Print(v + 1)
}
fmt.Println()
} else {
fmt.Println(-1)
}
}
```