← Home
For problem statement at 0-999/100-199/100-109/100/problemB.txt this is a correct solution, but verifier at 0-999/100-199/100-109/100/verifierB.go ends with All tests passed can you fix the verifier? package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strings"
)

func main() {
	data, _ := io.ReadAll(bufio.NewReader(os.Stdin))
	s := strings.ReplaceAll(string(data), ",", " ")
	in := strings.NewReader(s)

	var n int
	fmt.Fscan(in, &n)

	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Fscan(in, &a[i])
	}

	for i := 0; i < n; i++ {
		for j := i + 1; j < n; j++ {
			if a[i]%a[j] != 0 && a[j]%a[i] != 0 {
				fmt.Print("NOT FRIENDS")
				return
			}
		}
	}

	fmt.Print("FRIENDS")
}