For problem statement at 1000-1999/1300-1399/1380-1389/1381/problemA1.txt this is a correct solution, but verifier at 1000-1999/1300-1399/1380-1389/1381/verifierA1.go ends with All 66 tests passed can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
)
func flip(c byte) byte {
if c == '0' {
return '1'
}
return '0'
}
func apply(s []byte, k int) {
for i := 0; i < k/2; i++ {
x := flip(s[i])
y := flip(s[k-1-i])
s[i], s[k-1-i] = y, x
}
if k%2 == 1 {
m := k / 2
s[m] = flip(s[m])
}
}
func main() {
in := bufio.NewReader(os.Stdin)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
var t int
fmt.Fscan(in, &t)
for ; t > 0; t-- {
var n int
var a, b string
fmt.Fscan(in, &n)
fmt.Fscan(in, &a)
fmt.Fscan(in, &b)
s := []byte(a)
ops := make([]int, 0, 2*n)
for i := n - 1; i >= 0; i-- {
if s[i] == b[i] {
continue
}
if s[0] == b[i] {
ops = append(ops, 1)
s[0] = flip(s[0])
}
ops = append(ops, i+1)
apply(s, i+1)
}
fmt.Fprint(out, len(ops))
for _, v := range ops {
fmt.Fprint(out, " ", v)
}
fmt.Fprintln(out)
}
}