← Home
For problem statement at 1000-1999/1800-1899/1860-1869/1867/problemE2.txt this is a correct solution, but verifier at 1000-1999/1800-1899/1860-1869/1867/verifierE2.go ends with test 1 failed
input:
1
3 3
864091877 711863369 304254853
expected:
197942569
got:
? 1
! 864091877

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

import "fmt"

func main() {
	var t int
	fmt.Scan(&t)
	for i := 0; i < t; i++ {
		solve()
	}
}

func solve() {
	var n, k int
	fmt.Scan(&n, &k)

	// Determine the target remainder size r.
	// We need r to be even to use the 2-query overlap strategy at the end.
	// Standard remainder is n % k.
	// If n % k is odd, we must have k odd (since if k were even, n%k would have same parity as n? 
	// actually parity of n%k depends on n and k, but we can change the remainder size by processing one less block).
	// If rem is odd, we target r = rem + k. Since rem is odd, k must be odd, so rem+k is even.
	// If rem is even, we target r = rem.
	rem := n % k
	var r int
	if rem%2 != 0 {
		r = rem + k
	} else {
		r = rem
	}

	// Calculate number of blocks to process normally
	// Total elements n. We want to leave r elements.
	// Prefix to process: n - r.
	// Number of queries: (n - r) / k.
	blocks := (n - r) / k
	
	currentXor := 0
	
	// Step 1: Process disjoint blocks
	for i := 0; i < blocks; i++ {
		fmt.Printf("? %d\n", 1+i*k)
		var val int
		fmt.Scan(&val)
		currentXor ^= val
	}
	
	// Step 2: Handle the remainder r
	if r > 0 {
		m := r / 2
		// Query 1
		fmt.Printf("? %d\n", n-m-k+1)
		var val1 int
		fmt.Scan(&val1)
		currentXor ^= val1
		
		// Query 2
		fmt.Printf("? %d\n", n-k+1)
		var val2 int
		fmt.Scan(&val2)
		currentXor ^= val2
	}
	
	fmt.Printf("! %d\n", currentXor)
}
```