package main import . "fmt" import . "sort" import "math/rand" func main() { var n, s int Scan(&n,&s) p:=make([]int,n) for i:=range p { Scan(&p[i]) } idx:=rand.Perm(n) Slice(idx,func(i,j int)bool { a:=idx[i] b:=idx[j] return p[a]
0&&p[i]-p[idx[j-1]]<=s {
continue
}
if j+1