For problem statement at 0-999/0-99/40-49/44/problemI.txt this is a correct solution, but verifier at 0-999/0-99/40-49/44/verifierI.go ends with case 1 failed: expected "1\n{1}" got "1\n1"
input:1
exit status 1 can you fix the verifier? ```go
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
)
var (
n int
pos []int
dirs []int
total int
output [][]int
)
func solve(idx, k int) {
if idx == n+1 {
part := make([]int, n+1)
copy(part, pos)
output = append(output, part)
total++
return
}
if dirs[idx] == 1 {
for b := 1; b <= k; b++ {
pos[idx] = b
solve(idx+1, k)
if idx+1 <= n {
dirs[idx+1] *= -1
}
}
pos[idx] = k + 1
solve(idx+1, k+1)
if idx+1 <= n {
dirs[idx+1] *= -1
}
} else {
pos[idx] = k + 1
solve(idx+1, k+1)
if idx+1 <= n {
dirs[idx+1] *= -1
}
for b := k; b >= 1; b-- {
pos[idx] = b
solve(idx+1, k)
if idx+1 <= n {
dirs[idx+1] *= -1
}
}
}
}
func main() {
if _, err := fmt.Scan(&n); err != nil {
return
}
pos = make([]int, n+1)
dirs = make([]int, n+1)
for i := 1; i <= n; i++ {
dirs[i] = 1
}
solve(1, 0)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
fmt.Fprintln(out, total)
for _, p := range output {
maxB := 0
for i := 1; i <= n; i++ {
if p[i] > maxB {
maxB = p[i]
}
}
var piles []string
for b := 1; b <= maxB; b++ {
var elements []string
for i := 1; i <= n; i++ {
if p[i] == b {
elements = append(elements, strconv.Itoa(i))
}
}
piles = append(piles, strings.Join(elements, ","))
}
fmt.Fprintln(out, strings.Join(piles, "-"))
}
}
```