For problem statement at 1000-1999/1100-1199/1140-1149/1142/problemB.txt this is a correct solution, but verifier at 1000-1999/1100-1199/1140-1149/1142/verifierB.go ends with Accepted (8 tests) can you fix the verifier? ```go
package main
import (
"bufio"
"fmt"
"os"
"sort"
)
func main() {
in := bufio.NewReader(os.Stdin)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
var n, m, q int
fmt.Fscan(in, &n, &m, &q)
p := make([]int, n+1)
for i := 1; i <= n; i++ {
fmt.Fscan(in, &p[i])
}
nextVal := make([]int, n+1)
for i := 1; i <= n; i++ {
if i < n {
nextVal[p[i]] = p[i+1]
} else {
nextVal[p[i]] = p[1]
}
}
a := make([]int, m+1)
for i := 1; i <= m; i++ {
fmt.Fscan(in, &a[i])
}
pos := make([][]int, n+1)
for i := 1; i <= m; i++ {
pos[a[i]] = append(pos[a[i]], i)
}
const INF = int(1e9)
jump := make([]int, m+2)
for i := 1; i <= m; i++ {
v := a[i]
nxt := nextVal[v]
arr := pos[nxt]
idx := sort.Search(len(arr), func(j int) bool {
return arr[j] > i
})
if idx < len(arr) {
jump[i] = arr[idx]
} else {
jump[i] = m + 1
}
}
LOG := 20
up := make([][]int, LOG)
for i := 0; i < LOG; i++ {
up[i] = make([]int, m+2)
}
for i := 1; i <= m; i++ {
up[0][i] = jump[i]
}
up[0][m+1] = m + 1
for k := 1; k < LOG; k++ {
for i := 1; i <= m+1; i++ {
up[k][i] = up[k-1][up[k-1][i]]
}
}
reach := make([]int, m+2)
for i := 1; i <= m; i++ {
cur := i
steps := n - 1
for k := 0; k < LOG; k++ {
if steps&(1<<k) != 0 {
cur = up[k][cur]
if cur > m {
break
}
}
}
if cur <= m {
reach[i] = cur
} else {
reach[i] = INF
}
}
lg := make([]int, m+2)
for i := 2; i <= m; i++ {
lg[i] = lg[i/2] + 1
}
K := lg[m] + 1
st := make([][]int, K)
for i := 0; i < K; i++ {
st[i] = make([]int, m+2)
}
for i := 1; i <= m; i++ {
st[0][i] = reach[i]
}
for k := 1; k < K; k++ {
for i := 1; i+(1<<k)-1 <= m; i++ {
st[k][i] = min(st[k-1][i], st[k-1][i+(1<<(k-1))])
}
}
res := make([]byte, q)
for i := 0; i < q; i++ {
var l, r int
fmt.Fscan(in, &l, &r)
j := lg[r-l+1]
minReach := min(st[j][l], st[j][r-(1<<j)+1])
if minReach <= r {
res[i] = '1'
} else {
res[i] = '0'
}
}
fmt.Fprintln(out, string(res))
}
func min(a, b int) int {
if a < b {
return a
}
return b
}
```