← Home
For problem statement at 0-999/100-199/190-199/192/problemB.txt this is a correct solution, but verifier at 0-999/100-199/190-199/192/verifierB.go ends with All tests passed can you fix the verifier? ```go
package main

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

func main() {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)

	if !scanner.Scan() {
		return
	}
	n, _ := strconv.Atoi(scanner.Text())

	a := make([]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		a[i], _ = strconv.Atoi(scanner.Text())
	}

	// Calculate maximum possible days limited by start and end tiles
	maxDays := 1000
	if n > 0 {
		if a[0] < maxDays {
			maxDays = a[0]
		}
		if a[n-1] < maxDays {
			maxDays = a[n-1]
		}
	}

	// Check from max possible days down to 0
	for d := maxDays; d >= 0; d-- {
		if canReach(n, a, d) {
			fmt.Println(d)
			return
		}
	}
}

func canReach(n int, a []int, d int) bool {
	if d == 0 {
		return true
	}
	// Start and end tiles must be valid on day d
	if a[0] < d || a[n-1] < d {
		return false
	}

	// dp[i] indicates if tile i is reachable from start
	dp := make([]bool, n)
	dp[0] = true

	for i := 0; i < n-1; i++ {
		if !dp[i] {
			continue
		}
		// Try moving to i+1
		if a[i+1] >= d {
			dp[i+1] = true
		}
		// Try moving to i+2
		if i+2 < n && a[i+2] >= d {
			dp[i+2] = true
		}
	}

	return dp[n-1]
}
```