For problem statement at 1000-1999/1400-1499/1400-1409/1400/problemE.txt this is a correct solution, but verifier at 1000-1999/1400-1499/1400-1409/1400/verifierE.go ends with build oracle failed: exit status 1
# command-line-arguments
./1400E.go:20:4: declared and not used: minPos
exit status 1 can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
)
func main() {
in := bufio.NewReaderSize(os.Stdin, 1<<20)
var n int
fmt.Fscan(in, &n)
a := make([]int64, n)
for i := 0; i < n; i++ {
fmt.Fscan(in, &a[i])
}
var solve func(int, int, int64) int64
solve = func(l, r int, base int64) int64 {
if l > r {
return 0
}
width := int64(r - l + 1)
mn := a[l]
for i := l + 1; i <= r; i++ {
if a[i] < mn {
mn = a[i]
}
}
if mn-base >= width {
return width
}
cost := mn - base
i := l
for i <= r {
if a[i] == mn {
i++
continue
}
j := i
for j <= r && a[j] > mn {
j++
}
cost += solve(i, j-1, mn)
if cost >= width {
return width
}
i = j
}
if cost < width {
return cost
}
return width
}
var ans int64
i := 0
for i < n {
for i < n && a[i] == 0 {
i++
}
if i == n {
break
}
j := i
for j < n && a[j] > 0 {
j++
}
ans += solve(i, j-1, 0)
i = j
}
fmt.Println(ans)
}