← Home
For problem statement at 1000-1999/1100-1199/1160-1169/1163/problemB1.txt this is a correct solution, but verifier at 1000-1999/1100-1199/1160-1169/1163/verifierB1.go ends with All 100 tests passed. can you fix the verifier? ```go
package main

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

func main() {
	in := bufio.NewReader(os.Stdin)
	var n int
	fmt.Fscan(in, &n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
	}

	const maxColor = 100000
	cnt := make([]int, maxColor+1)
	freq := make([]int, n+2)

	maxF := 0
	ans := 1

	colorsWithPositive := 0

	for i := 0; i < n; i++ {
		x := a[i]
		old := cnt[x]
		if old > 0 {
			freq[old]--
		} else {
			colorsWithPositive++
		}
		cnt[x] = old + 1
		newv := old + 1
		freq[newv]++
		if newv > maxF {
			maxF = newv
		}
		for maxF > 0 && freq[maxF] == 0 {
			maxF--
		}

		ok := false
		L := i + 1

		if maxF == 1 {
			ok = true
		} else {
			if freq[1] == 1 && freq[maxF]*maxF+1 == L {
				ok = true
			} else {
				if freq[maxF] == 1 && freq[maxF-1]*(maxF-1)+maxF == L {
					ok = true
				}
			}
		}

		if ok {
			ans = L
		}
	}

	fmt.Print(ans)
}
```