For problem statement at 2000-2999/2000-2099/2000-2009/2002/problemC.txt this is a correct solution, but verifier at 2000-2999/2000-2099/2000-2009/2002/verifierC.go ends with All tests passed. can you fix the verifier? package main
import (
"bufio"
"fmt"
"math/bits"
"os"
)
type FastScanner struct {
r *bufio.Reader
}
func NewFastScanner() *FastScanner {
return &FastScanner{r: bufio.NewReaderSize(os.Stdin, 1<<20)}
}
func (fs *FastScanner) nextInt64() int64 {
sign := int64(1)
var val int64
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 + int64(c-'0')
c2, err := fs.r.ReadByte()
if err != nil {
break
}
c = c2
}
return val * sign
}
func abs64(x int64) uint64 {
if x < 0 {
return uint64(-x)
}
return uint64(x)
}
func sqDist128(x1, y1, x2, y2 int64) (uint64, uint64) {
dx := abs64(x1 - x2)
dy := abs64(y1 - y2)
hiX, loX := bits.Mul64(dx, dx)
hiY, loY := bits.Mul64(dy, dy)
lo, c := bits.Add64(loX, loY, 0)
hi, _ := bits.Add64(hiX, hiY, c)
return hi, lo
}
func less128(ahi, alo, bhi, blo uint64) bool {
if ahi != bhi {
return ahi < bhi
}
return alo < blo
}
func main() {
in := NewFastScanner()
out := bufio.NewWriterSize(os.Stdout, 1<<20)
defer out.Flush()
t := int(in.nextInt64())
for ; t > 0; t-- {
n := int(in.nextInt64())
xs := make([]int64, n)
ys := make([]int64, n)
for i := 0; i < n; i++ {
xs[i] = in.nextInt64()
ys[i] = in.nextInt64()
}
xs0 := in.nextInt64()
ys0 := in.nextInt64()
xt := in.nextInt64()
yt := in.nextInt64()
dhi, dlo := sqDist128(xs0, ys0, xt, yt)
minHi, minLo := uint64(^uint64(0)), uint64(^uint64(0))
for i := 0; i < n; i++ {
hi, lo := sqDist128(xs[i], ys[i], xt, yt)
if less128(hi, lo, minHi, minLo) {
minHi, minLo = hi, lo
}
}
if less128(dhi, dlo, minHi, minLo) {
fmt.Fprintln(out, "YES")
} else {
fmt.Fprintln(out, "NO")
}
}
}