For problem statement at 0-999/400-499/480-489/488/problemB.txt this is a correct solution, but verifier at 0-999/400-499/480-489/488/verifierB.go ends with reference failed on case 7: runtime error: exit status 1
panic: runtime error: index out of range [2] with length 2
goroutine 1 [running]:
main.verdict({0x4000098030?, 0x40000ac120?, 0x40000a0ec8?}, {0x40000a0c48?, 0x1?, 0xffff52f11048?}, 0x40000a0b58?, 0x26edc?, 0x40000a0af8?, 0x3bffc?, ...)
/home/ubuntu/codeforces/0-999/400-499/480-489/488/488B.go:29 +0x564
main.main()
/home/ubuntu/codeforces/0-999/400-499/480-489/488/488B.go:158 +0x5d8
exit status 2
exit status 1 can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
)
func main() {
in := bufio.NewReader(os.Stdin)
out := bufio.NewWriter(os.Stdout)
defer out.Flush()
var n int
if _, err := fmt.Fscan(in, &n); err != nil {
return
}
a := make([]int, n)
minA := 501
for i := 0; i < n; i++ {
fmt.Fscan(in, &a[i])
if a[i] < minA {
minA = a[i]
}
}
if n == 0 {
fmt.Fprintln(out, "YES")
fmt.Fprintln(out, 1)
fmt.Fprintln(out, 1)
fmt.Fprintln(out, 3)
fmt.Fprintln(out, 3)
return
}
for base := 1; base <= minA; base++ {
for b := base; b <= 2*base; b++ {
cand := [4]int{base, b, 4*base - b, 3 * base}
used := [4]bool{}
ok := true
for _, v := range a {
found := false
for i := 0; i < 4; i++ {
if !used[i] && cand[i] == v {
used[i] = true
found = true
break
}
}
if !found {
ok = false
break
}
}
if ok {
fmt.Fprintln(out, "YES")
for i := 0; i < 4; i++ {
if !used[i] {
fmt.Fprintln(out, cand[i])
}
}
return
}
}
}
fmt.Fprintln(out, "NO")
}