For problem statement at 1000-1999/1500-1599/1540-1549/1545/problemA.txt this is a correct solution, but verifier at 1000-1999/1500-1599/1540-1549/1545/verifierA.go ends with All tests passed can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
"sort"
"strconv"
)
func main() {
scanner := bufio.NewScanner(os.Stdin)
scanner.Split(bufio.ScanWords)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
nextInt := func() int {
scanner.Scan()
res, _ := strconv.Atoi(scanner.Text())
return res
}
if !scanner.Scan() {
return
}
t, _ := strconv.Atoi(scanner.Text())
var cntEven [100005]int
var cntOdd [100005]int
for tc := 0; tc < t; tc++ {
n := nextInt()
a := make([]int, n)
for i := 0; i < n; i++ {
a[i] = nextInt()
if i%2 == 0 {
cntEven[a[i]]++
} else {
cntOdd[a[i]]++
}
}
sort.Ints(a)
for i := 0; i < n; i++ {
if i%2 == 0 {
cntEven[a[i]]--
} else {
cntOdd[a[i]]--
}
}
possible := true
for i := 0; i < n; i++ {
if cntEven[a[i]] != 0 || cntOdd[a[i]] != 0 {
possible = false
}
cntEven[a[i]] = 0
cntOdd[a[i]] = 0
}
if possible {
fmt.Fprintln(out, "YES")
} else {
fmt.Fprintln(out, "NO")
}
}
}