For problem statement at 0-999/500-599/590-599/599/problemB.txt this is a correct solution, but verifier at 0-999/500-599/590-599/599/verifierB.go ends with All 100 tests passed can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
"strings"
)
type FastScanner struct {
r *bufio.Reader
}
func NewFastScanner() *FastScanner {
return &FastScanner{r: bufio.NewReaderSize(os.Stdin, 1<<20)}
}
func (fs *FastScanner) NextInt() int {
sign, val := 1, 0
c, _ := fs.r.ReadByte()
for (c < '0' || c > '9') && c != '-' {
c, _ = fs.r.ReadByte()
}
if c == '-' {
sign = -1
c, _ = fs.r.ReadByte()
}
for c >= '0' && c <= '9' {
val = val*10 + int(c-'0')
c, _ = fs.r.ReadByte()
}
fs.r.UnreadByte()
return sign * val
}
func main() {
in := NewFastScanner()
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
n := in.NextInt()
m := in.NextInt()
cnt := make([]int, n+1)
pre := make([]int, n+1)
for i := 1; i <= n; i++ {
x := in.NextInt()
if cnt[x] == 0 {
pre[x] = i
}
cnt[x]++
}
ans := make([]int, m)
amb := false
for i := 0; i < m; i++ {
b := in.NextInt()
if cnt[b] == 0 {
fmt.Fprint(out, "Impossible")
return
}
if cnt[b] > 1 {
amb = true
}
ans[i] = pre[b]
}
if amb {
fmt.Fprint(out, "Ambiguity")
return
}
fmt.Fprintln(out, "Possible")
var sb strings.Builder
for i, v := range ans {
if i > 0 {
sb.WriteByte(' ')
}
sb.WriteString(fmt.Sprintf("%d", v))
}
fmt.Fprint(out, sb.String())
}