For problem statement at 1000-1999/1300-1399/1330-1339/1332/problemB.txt this is a correct solution, but verifier at 1000-1999/1300-1399/1330-1339/1332/verifierB.go ends with case 3 failed: expected 1 got 0
arr: [479]
exit status 1 can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
)
type FastScanner struct {
r *bufio.Reader
}
func (fs *FastScanner) NextInt() int {
sign, val := 1, 0
c, _ := fs.r.ReadByte()
for (c < '0' || c > '9') && c != '-' {
c, _ = fs.r.ReadByte()
}
if c == '-' {
sign = -1
c, _ = fs.r.ReadByte()
}
for c >= '0' && c <= '9' {
val = val*10 + int(c-'0')
c, _ = fs.r.ReadByte()
}
fs.r.UnreadByte()
return sign * val
}
func main() {
in := &FastScanner{r: bufio.NewReaderSize(os.Stdin, 1<<20)}
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
primes := []int{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31}
t := in.NextInt()
for ; t > 0; t-- {
n := in.NextInt()
ans := make([]int, n)
colorOfPrime := make(map[int]int)
m := 0
for i := 0; i < n; i++ {
x := in.NextInt()
for _, p := range primes {
if x%p == 0 {
if colorOfPrime[p] == 0 {
m++
colorOfPrime[p] = m
}
ans[i] = colorOfPrime[p]
break
}
}
}
fmt.Fprintln(out, m)
for i := 0; i < n; i++ {
if i > 0 {
fmt.Fprint(out, " ")
}
fmt.Fprint(out, ans[i])
}
fmt.Fprintln(out)
}
}