rt
#include <bits/stdc++.h>
#define rep(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define pre(i,a,n) for(int (i)=(a);(i)>=(n);(i)--)
#define ull unsigned long long
#define int long long
using namespace std;
const int N = 1000 + 10;
struct node
{
int x, y;
}land[N];
struct Point
{
int l, r;
bool operator < (const Point &nd) const
{
return r < nd.r;
}
}a[N];
int n, d;
int get(int i)
{
return sqrt(d * d - land[i].y * land[i].y);
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> d;
bool f = false;
rep(i, 1, n)
{
cin >> land[i].x >> land[i].y;
if (land[i].y > d) f = true;
}
if (f)
{
cout << -1;
return 0;
}
rep(i, 1, n)
{
int d = get(i);
a[i].l = land[i].x - d;
a[i].r = land[i].x + d;
}
sort(a + 1, a + 1 + n);
int cnt = 1, now = a[1].r;
rep(i, 2, n)
{
if (now < a[i].l) cnt++, now = a[i].r;
}
cout << cnt << "\n";
return 0;
}
附上Wa的数据 in
out:
5