For problem statement at 1000-1999/1900-1999/1900-1909/1903/problemB.txt this is a correct solution, but verifier at 1000-1999/1900-1999/1900-1909/1903/verifierB.go ends with failed to read t: EOF
exit status 1 can you fix the verifier? package main
import (
"bufio"
"os"
"strconv"
)
type FastScanner struct {
r *bufio.Reader
}
func NewFastScanner() *FastScanner {
return &FastScanner{r: bufio.NewReaderSize(os.Stdin, 1<<20)}
}
func (fs *FastScanner) nextInt() int64 {
sign := int64(1)
val := int64(0)
c, _ := fs.r.ReadByte()
for c <= ' ' {
c, _ = fs.r.ReadByte()
}
if c == '-' {
sign = -1
c, _ = fs.r.ReadByte()
}
for c > ' ' {
val = val*10 + int64(c-'0')
c, _ = fs.r.ReadByte()
}
return val * sign
}
func main() {
in := NewFastScanner()
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
t := int(in.nextInt())
FULL := uint32((1 << 30) - 1)
for ; t > 0; t-- {
n := int(in.nextInt())
M := make([]uint32, n*n)
for i := 0; i < n; i++ {
row := i * n
for j := 0; j < n; j++ {
M[row+j] = uint32(in.nextInt())
}
}
a := make([]uint32, n)
for i := 0; i < n; i++ {
v := FULL
row := i * n
for j := 0; j < n; j++ {
if i == j {
continue
}
v &= M[row+j]
}
a[i] = v
}
ok := true
for i := 0; i < n && ok; i++ {
for j := 0; j < n; j++ {
if i == j {
continue
}
if (a[i] | a[j]) != M[i*n+j] {
ok = false
break
}
}
}
if !ok {
out.WriteString("NO\n")
continue
}
out.WriteString("YES\n")
for i := 0; i < n; i++ {
if i > 0 {
out.WriteByte(' ')
}
out.WriteString(strconv.FormatUint(uint64(a[i]), 10))
}
out.WriteByte('\n')
}
}