#include #include #include #include using namespace std; typedef long double ld; constexpr long double eps = 1e-11L; int sgn(ld x) { return (x > 0) - (x < 0); } struct Point { typedef Point P; ld x, y; Point(ld x=0, ld y=0): x(x), y(y) {} bool operator == (const P& p) const { return abs(x - p.x) < eps && abs(y - p.y) < eps; } P operator - (const P& p) const { return {x - p.x, y - p.y}; } P operator * (ld d) const { return {x * d, y * d}; } P operator / (ld d) const { return {x / d, y / d}; } ld dot(const P& p) const { return x * p.x + y * p.y; } ld cross(const P& p) const { return x * p.y - y * p.x; } ld dist2() const { return x * x + y * y; } ld dist() const { return sqrt(dist2()); } P unit() const { return *this / dist(); } P perp() const { return {-y, x}; } P normal() const { return perp().unit(); } } O(0, 0); ld lineDist(const Point& l, const Point& p) { return l.cross(p) / l.dist(); } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; ld r; Point line; vector> events; cin>>n>>r>>line.x>>line.y; for (int i = 0; i < n; ++i) { Point p; cin>>p.x>>p.y; ld d = lineDist(line, p); Point project = p - line.normal() * d; ld c = project.dist(); d = abs(d); if (project.y < -eps || (abs(project.y) < eps && project.x < -eps)) c = -c; if (d > r + eps) continue; ld w = sqrt(r * r - d * d + eps); events.emplace_back(c - w - eps, 1); events.emplace_back(c + w + eps, -1); //cout<