For problem statement at 0-999/900-999/920-929/923/problemB.txt this is a correct solution, but verifier at 0-999/900-999/920-929/923/verifierB.go ends with All tests passed can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
"strings"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanWords)
if !scanner.Scan() {
return
}
n, _ := strconv.Atoi(scanner.Text())
v := make([]int64, n+1)
for i := 1; i <= n; i++ {
scanner.Scan()
val, _ := strconv.ParseInt(scanner.Text(), 10, 64)
v[i] = val
}
t := make([]int64, n+1)
s := make([]int64, n+1)
for i := 1; i <= n; i++ {
scanner.Scan()
val, _ := strconv.ParseInt(scanner.Text(), 10, 64)
t[i] = val
s[i] = s[i-1] + val
}
fullCount := make([]int64, n+2)
remainder := make([]int64, n+2)
for i := 1; i <= n; i++ {
idx := sort.Search(n-i+1, func(k int) bool {
return s[i+k]-s[i-1] >= v[i]
}) + i
if idx > n {
fullCount[i]++
fullCount[n+1]--
} else {
fullCount[i]++
fullCount[idx]--
remainder[idx] += v[i] - (s[idx-1] - s[i-1])
}
}
var activeCount int64 = 0
ans := make([]string, n)
for i := 1; i <= n; i++ {
activeCount += fullCount[i]
melted := activeCount*t[i] + remainder[i]
ans[i-1] = strconv.FormatInt(melted, 10)
}
fmt.Println(strings.Join(ans, " "))
}