← Home
For problem statement at 0-999/0-99/70-79/75/problemD.txt this is a correct solution, but verifier at 0-999/0-99/70-79/75/verifierD.go ends with build oracle failed: exit status 1
# command-line-arguments
./75D.go:95:1: syntax error: unexpected EOF, expected }

exit status 1 can you fix the verifier? ```go
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func init() {
	sc.Split(bufio.ScanWords)
}

func scanInt() int {
	sc.Scan()
	v, _ := strconv.Atoi(sc.Text())
	return v
}

type Info struct {
	sum, maxSub, maxPre, maxSuf int64
}

func main() {
	if !sc.Scan() {
		return
	}
	n, _ := strconv.Atoi(sc.Text())
	m := scanInt()

	infos := make([]Info, n+1)

	for i := 1; i <= n; i++ {
		l := scanInt()
		arr := make([]int64, l)
		for j := 0; j < l; j++ {
			arr[j] = int64(scanInt())
		}

		var sum int64 = 0
		for _, v := range arr {
			sum += v
		}

		// Kadane's algorithm for max subarray inside the small array
		maxSub := arr[0]
		curr := arr[0]
		for j := 1; j < l; j++ {
			if curr < 0 {
				curr = arr[j]
			} else {
				curr += arr[j]
			}
			if curr > maxSub {
				maxSub = curr
			}
		}

		// Max prefix sum
		var maxPre int64 = 0
		var tmp int64 = 0
		for _, v := range arr {
			tmp += v
			if tmp > maxPre {
				maxPre = tmp
			}
		}

		// Max suffix sum
		var maxSuf int64 = 0
		tmp = 0
		for j := l - 1; j >= 0; j-- {
			tmp += arr[j]
			if tmp > maxSuf {
				maxSuf = tmp
			}
		}

		infos[i] = Info{sum, maxSub, maxPre, maxSuf}
	}

	var ans int64 = -4000000000000000000 // Initialize with a very small number
	var curSuf int64 = 0

	for i := 0; i < m; i++ {
		idx := scanInt()
		info := infos[idx]

		// Update global answer with the max subarray contained entirely within this block
		if info.maxSub > ans {
			ans = info.maxSub
		}

		// Check candidate subarray crossing into this block from previous blocks
		cand := curSuf + info.maxPre
		if cand > ans {
			// We can only choose a sum of 0 if we are not forced to pick a negative number.
			// Since we must pick at least one element, if ans is negative, 
			// we cannot update it with 0 (which would imply an empty subarray).
			// If cand > 0, it is definitely a valid non-empty sum.
			if ans >= 0 || cand > 0 {
				ans = cand
			}
		}

		// Update current max suffix for the next iteration
		extend := curSuf + info.sum
		if info.maxSuf > extend {
			curSuf = info.maxSuf
		} else {
			curSuf = extend
		}
	}

	fmt.Println(ans)
}
```