For problem statement at 1000-1999/1300-1399/1350-1359/1352/problemE.txt this is a correct solution, but verifier at 1000-1999/1300-1399/1350-1359/1352/verifierE.go ends with All 100 tests passed can you fix the verifier? package main
import (
"os"
)
const bufferSize = 1 << 16
func main() {
buf := make([]byte, bufferSize)
var pos, length int
nextByte := func() byte {
if pos >= length {
pos = 0
n, _ := os.Stdin.Read(buf)
if n == 0 {
return 0
}
length = n
}
res := buf[pos]
pos++
return res
}
nextInt := func() int {
b := nextByte()
for b <= ' ' && b != 0 {
b = nextByte()
}
if b == 0 {
return 0
}
res := 0
for b > ' ' {
res = res*10 + int(b-'0')
b = nextByte()
}
return res
}
outBuf := make([]byte, 0, bufferSize)
printInt := func(n int) {
if n == 0 {
outBuf = append(outBuf, '0')
outBuf = append(outBuf, '\n')
return
}
var temp [20]byte
i := 19
for n > 0 {
temp[i] = byte(n%10 + '0')
n /= 10
i--
}
outBuf = append(outBuf, temp[i+1:]...)
outBuf = append(outBuf, '\n')
if len(outBuf) > bufferSize-100 {
os.Stdout.Write(outBuf)
outBuf = outBuf[:0]
}
}
t := nextInt()
if t == 0 {
return
}
a := make([]int, 8005)
counts := make([]int, 8005)
isSpecial := make([]bool, 8005)
for i := 0; i < t; i++ {
n := nextInt()
for j := 0; j <= n; j++ {
counts[j] = 0
isSpecial[j] = false
}
for j := 0; j < n; j++ {
a[j] = nextInt()
counts[a[j]]++
}
ans := 0
for j := 0; j < n; j++ {
sum := a[j]
for k := j + 1; k < n; k++ {
sum += a[k]
if sum > n {
break
}
if !isSpecial[sum] {
isSpecial[sum] = true
ans += counts[sum]
}
}
}
printInt(ans)
}
if len(outBuf) > 0 {
os.Stdout.Write(outBuf)
}
}