这个程序为什么洛谷上AC了在其他网站会运行时错误?
#include<bits/stdc++.h>
using namespace std;
const int MAXN=1010;
struct Point{
double l,r;
}a[MAXN];
bool cmp(Point aa,Point bb){
return aa.r<bb.r;
}
int main(){
int n,d,ans=1;
scanf("%d%d",&n,&d);
for(int i=1;i<=n;i++){
int x,y;
scanf("%d%d",&x,&y);
if(y>d){
printf("-1");
return 0;
}
int dis=sqrt(d*d-y*y);
a[i].l=x-dis;a[i].r=x+dis;
}
sort(a+1,a+n+1,cmp);
double now=a[1].r;
for(int i=2;i<=n;i++)
if(now<a[i].l){
now=a[i].r;
ans++;
}
printf("%d",ans);
return 0;
}