← Home
For problem statement at 1000-1999/1000-1099/1030-1039/1039/problemB.txt this is a correct solution, but verifier at 1000-1999/1000-1099/1030-1039/1039/verifierB.go ends with Problem B is interactive and cannot be automatically verified. can you fix the verifier?  ```go
package main

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

var scanner = bufio.NewScanner(os.Stdin)

func query(l, r int64) bool {
	fmt.Printf("%d %d\n", l, r)
	if !scanner.Scan() {
		return false
	}
	s := strings.TrimSpace(scanner.Text())
	return s == "Yes"
}

func main() {
	scanner.Scan()
	line := strings.Fields(scanner.Text())
	n, _ := strconv.ParseInt(line[0], 10, 64)
	k, _ := strconv.ParseInt(line[1], 10, 64)
	
	l, r := int64(1), n
	
	for r-l > 4*k+1 {
		m := (l + r) / 2
		if query(l, m) {
			r = m + k
			l = l - k
		} else {
			l = m + 1 - k
			r = r + k
		}
		if l < 1 {
			l = 1
		}
		if r > n {
			r = n
		}
	}
	
	for {
		if l == r {
			query(l, l)
			fmt.Println(l)
			return
		}
		length := int64(2*k + 1)
		if r-l+1 < length {
			length = r - l + 1
		}
		mid := l + length - 1
		if query(l, mid) {
			r = mid + k
			l = l - k
		} else {
			l = mid + 1 - k
			r = r + k
		}
		if l < 1 {
			l = 1
		}
		if r > n {
			r = n
		}
	}
}
```

**Input/Output explanation:** The program reads `n` and `k`, then performs a two-phase search. Phase 1 reduces the search interval from size $n$ to size at most $4k+1$ using binary search that accounts for the train's movement (expanding the candidate interval by $k$ after each query). Phase 2 finishes the search when the interval is small by querying segments of length $2k+1$, which guarantees the interval size decreases until it reaches 1. The total number of queries is $O(\log n + k^2)$, well under the 4500 limit.