For problem statement at 0-999/0-99/10-19/18/problemA.txt this is a correct solution, but verifier at 0-999/0-99/10-19/18/verifierA.go ends with All tests passed can you fix the verifier? package main
import (
"bufio"
"fmt"
"os"
"sort"
)
type P struct {
x, y int
}
func dist2(a, b P) int {
dx := a.x - b.x
dy := a.y - b.y
return dx*dx + dy*dy
}
func isRight(p []P) bool {
s := []int{
dist2(p[0], p[1]),
dist2(p[1], p[2]),
dist2(p[0], p[2]),
}
sort.Ints(s)
return s[0] > 0 && s[1] > 0 && s[0]+s[1] == s[2]
}
func main() {
in := bufio.NewReader(os.Stdin)
var x1, y1, x2, y2, x3, y3 int
fmt.Fscan(in, &x1, &y1, &x2, &y2, &x3, &y3)
p := []P{{x1, y1}, {x2, y2}, {x3, y3}}
if isRight(p) {
fmt.Println("RIGHT")
return
}
dirs := []P{{1, 0}, {-1, 0}, {0, 1}, {0, -1}}
for i := 0; i < 3; i++ {
for _, d := range dirs {
q := make([]P, 3)
copy(q, p)
q[i].x += d.x
q[i].y += d.y
if isRight(q) {
fmt.Println("ALMOST")
return
}
}
}
fmt.Println("NEITHER")
}