贪心,错题
#include <iostream>
#include <algorithm>
#include <cstring>
#include <set>
#include <vector>
#include <math.h>
#include<map>
#include<deque>
using namespace std;
struct type
{
double x, y;
bool operator < (const type & w) const
{
return x < w.x;
}
}s[100100];
int main()
{
int n;
double len, w;
while (~scanf("%d%lf%lf", &n, &len, &w))
{
int idx = 0;
double a, b;
for (int i = 0; i < n; i++)
{
cin >> a >> b;
if (b <= (w / 2)) continue;
double dist = sqrt(b * b - (w * w / 4.0));
s[idx].x = a - dist;
s[idx++].y = a + dist;
}
sort(s, s + idx);
double L = 0,R=0;
int res = 0;
bool leap = true;
while (R < len)
{
L = R;
int flag = 0;
for (int i = 0; i < idx; i++)
{
if (s[i].x <= L && s[i].y > R)
{
R = s[i].y;
}
}
if (L == R && L < len)
{
leap = false;
break;
}
res++;
}
if (leap)
cout << res << endl;
else
cout << -1 << endl;
}
}