Problem:
Tiny Room
You are an employee of Automatic Cleaning Machine (ACM) and a member of the development team of Intelligent Circular Perfect Cleaner (ICPC). ICPC is a robot that cleans up the dust of the place which it passed through.
Your task is an inspection of ICPC. This inspection is performed by checking whether the center of ICPC reaches all the $N$ given points.
However, since the laboratory is small, it may be impossible to place all the points in the laboratory so that the entire body of ICPC is contained in the laboratory during the inspection. The laboratory is a rectangle of $H \times W$ and ICPC is a circle of radius $R$. You decided to write a program to check whether you can place all the points in the laboratory by rotating and/or translating them while maintaining the distance between arbitrary two points.
Input
The input consists of a single test case of the following format.
$N$ $H$ $W$ $R$
$x_1$ $y_1$
:
$x_N$ $y_N$
The first line consists of four integers $N, H, W$ and $R$ ($1 \leq N \leq 100$, $1 \leq H, W \leq 10^9$, $1 \leq R \leq 10^6$). The following $N$ lines represent the coordinates of the points which the center of ICPC must reach. The ($i+1$)-th line consists of two integers $x_i$ and $y_i$ ($0 \leq x_i, y_i \leq 10^9$). $x_i$ and $y_i$ represent the $x$ and $y$ coordinates of the $i$-th point, respectively. It is guaranteed that the answer will not change even if $R$ changes by $1$.
Output
If all the points can be placed in the laboratory, print '
Yes
'. Otherwise, print '
No
'.
Sample Input 1
4 20 20 1
10 0
20 10
10 20
0 10
Output for Sample Input 1
Yes
All the points can be placed in the laboratory by rotating them through $45$ degrees.
Sample Input 2
2 5 55 1
0 0
30 40
Output for Sample Input 2
Yes
Sample Input 3
2 5 49 1
0 0
30 40
Output for Sample Input 3
No
Sample Input 4
1 3 3 1
114 514
Output for Sample Input 4
Yes

Submitted solutions:

code_snippet: #include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
using ll = long long;
template<class T> bool chmin(T &a,const T b){if(a>b){a=b;return 1;}return 0;}
template<class T> bool chmax(T &a,const T b){if(a<b){a=b;return 1;}return 0;}
const int INF = (1<<30)-1;
const ll  ILL = 1e15;
#define all(p) p.begin(),p.end()
const int mod=998244353;
using ld = long double;

int main(){
	auto mul=[&](pair<ld,ld> a,pair<ld,ld> b)->pair<ld,ld>{
		return {a.first*b.first-a.second*b.second,a.first*b.second+a.second*b.first};
	};
	auto Abs=[&](pair<ld,ld> a)->ld{
		return a.first*a.first+a.second*a.second;
	};
	auto div=[&](pair<ld,ld> a,pair<ld,ld> b)->pair<ld,ld>{
		auto tmp=mul(a,{b.first,-b.second});
		ld x=Abs(b);
		return {tmp.first/x,tmp.second/x};
	};
	ll N,H,W,R;
	cin>>N>>H>>W>>R;
	vector<ld> X(N),Y(N);
	rep(i,0,N) cin>>X[i]>>Y[i];
	H-=2*R;
	W-=2*R;
	if(min(H,W)<=0){
		cout<<"No\n";
		return 0;
	}
	if(N==1){
		cout<<"Yes\n";
		return 0;
	}
	rep(i,0,N) rep(j,i+1,N){
		pair<ld,ld> tmp={X[j]-X[i],Y[j]-Y[i]};
		if(Abs(tmp)>=H*H+W*W){
			cout<<"No\n";
			return 0;
		}
		if(Abs(tmp)<=min(H*H,W*W)) continue;
		rep(k,0,4){
			pair<ld,ld> s;
			if(k&1){
				if(Abs(tmp)<H*H) continue;
				s.first=H,s.second=sqrtl(Abs(tmp)-H*H);
			}
			else{
				if(Abs(tmp)<W*W) continue;
				s.second=W,s.first=sqrtl(Abs(tmp)-W*W);
			}
			if(k<2) s.first*=-1;
			auto e=div(s,tmp);
			int C=1;
			rep(l,0,N) rep(m,l+1,N){
				auto val=mul({X[l]-X[m],Y[l]-Y[m]},e);
				if(abs(val.first)>=H+1||abs(val.second)>=W+1){
					C=0;
					break;
				}
			}
			if(C){
				cout<<"Yes\n";
				return 0;
			}
		}
	}
	cout<<"No\n";
}
accuracy: 1
time_ms: 20
memory_kb: 3520
final_rank: 1

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef complex<double> Point;
constexpr double EPS = 1e-6;
const double PI = acos(-1);

Point rotate(Point p, double theta) { return p * exp(1i * theta); }
vector<Point> rotate(vector<Point> ps, double theta) {
    for (auto &p : ps) {
        p = rotate(p, theta);
    }
    return ps;
}

bool ok(const vector<Point> &ps, int h, int w) {
    double xmin = 1e18, xmax = -1e18, ymin = 1e18, ymax = -1e18;
    for (auto &p : ps) {
        xmin = min(xmin, p.real());
        xmax = max(xmax, p.real());
        ymin = min(ymin, p.imag());
        ymax = max(ymax, p.imag());
    }
    double x = xmax - xmin;
    double y = ymax - ymin;
    if (x > y) swap(x, y);
    if (h > w) swap(h, w);
    return x <= h + EPS && y <= w + EPS;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    double h, w, r;
    cin >> n >> h >> w >> r;
    h -= 2 * r, w -= 2 * r;
    if (h < 0 || w < 0) {
        cout << "No" << endl;
        return 0;
    }
    vector<Point> ps;
    for (int i = 0; i < n; i++) {
        double a, b;
        cin >> a >> b;
        ps.emplace_back(a, b);
    }

    bool multi = false;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (ps[i] == ps[j]) continue;
            multi = true;
            double theta = atan((ps[i].imag() - ps[j].imag()) / (ps[i].real() - ps[j].real() + EPS));
            auto qs = rotate(ps, theta);
            if (ok(qs, h, w)) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    if (!multi) {
        cout << "Yes" << endl;
        return 0;
    }

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            for (int H : {w, h}) {
                if (ps[i] == ps[j]) continue;
                double theta1 = atan((ps[i].imag() - ps[j].imag()) / (ps[i].real() - ps[j].real() + EPS));
                double c = hypot(ps[i].imag() - ps[j].imag(), ps[i].real() - ps[j].real());
                if (c <= H + EPS) continue;
                double theta2 = PI / 2 - acos(H / c);
                auto qs = rotate(ps, theta2 - theta1);
                if (ok(qs, h, w)) {
                    cout << "Yes" << endl;
                    return 0;
                }
                double theta3 = acos(H / c);
                qs = rotate(ps, theta3 - theta1);
                if (ok(qs, h, w)) {
                    cout << "Yes" << endl;
                    return 0;
                }
            }
        }
    }
    cout << "No" << endl;
}
accuracy: 1
time_ms: 10
memory_kb: 3804
final_rank: 2

code_snippet: #include<bits/stdc++.h>
#define inf (1e12)
#define eps (1e-5)
#define Eps (1e-15)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f ",(double)(a))
#define pdouble(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

class Point{
public:
  double x,y;
  Point(double x=0,ld y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ 
    return equals(x,p.x) ? y-p.y<-eps : x-p.x<-eps; }
  bool operator==(Point p)const{ 
    return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
  bool operator==(Segment s)const{
    if(s.p1==p1 && s.p2==p2)return true;
    if(s.p2==p1 && s.p1==p2)return true;
    return false;
  }
};
typedef Segment Line;

double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}

Point project(Segment s,Point p){
  Vector base=(s.p2-s.p1);
  double r=(dot(p-s.p1,base)/base.norm());
  return (s.p1+base*r);
}

int ccw(Point p0,Point p1,Point p2){
  Vector a=p1-p0;
  Vector b=p2-p0;
  if(cross(a,b)>eps)return 1;
  if(cross(a,b)<-eps)return -1;
  if(dot(a,b)<-eps)return 2;
  if(a.norm()<b.norm())return -2;
  return 0;
}

Point rotate(Point base,Point a,double r){
  Point b=a-base;
  a.x=b.x*cos((r/180.0)*pi)-b.y*sin((r/180.0)*pi);
  a.y=b.x*sin((r/180.0)*pi)+b.y*cos((r/180.0)*pi);
  a=a+base;
  return a;
}

int N;
double H,W,R;
double h,w;
Point o = Point(0,0);
vector<Point> vp;
vector<Vector> cand;

bool check(Vector v){
  Line L = Line(o,v);
  double w1=0,w2=inf,w3=inf,w4=0,sumw = 0;
  double h1=0,h2=inf,h3=inf,h4=0,sumh = 0;
  FOR(i,0,N){
    Point p = project(L,vp[i]);
    double dis = abs(p);
    if(ccw(o,v,p)==2){
      if(dis-w3<eps)w3 = dis;
      if(w4-dis<eps)w4 = dis;
    }
    else {
      if(dis-w2<eps)w2 = dis;
      if(w1-dis<eps)w1 = dis;
    }
    dis = abs(vp[i]-p);
    if(ccw(o,v,vp[i])==1){
      if(dis-h3<eps)h3 = dis;
      if(h4-dis<eps)h4 = dis;
    }
    else{
      if(dis-h2<eps)h2 = dis;
      if(h1-dis<eps)h1 = dis;
    }
  }
  if(!equals(w4,0) )sumw+=w4;
  if(equals(w3,inf))sumw-=w2;
  if(!equals(w1,0) )sumw+=w1;
  if(equals(w2,inf))sumw-=w3;

  if(!equals(h4,0) )sumh+=h4;
  if(equals(h3,inf))sumh-=h2;
  if(!equals(h1,0)) sumh+=h1;
  if(equals(h2,inf))sumh-=h3;

  if(sumh-h<eps && sumw-w<eps)return true;
  if(sumh-w<eps && sumw-h<eps)return true;
  return false;
}

string solve(){
  h = (H-R-R),w = (W-R-R); 
  if(N==1){
    if(2.0*R-H<eps && 2.0*R-W<eps)return "Yes";
    return "No";
  }
  FOR(i,0,vp.size()){
    FOR(j,0,vp.size()){
      if(i==j)continue;
      Point a=vp[i],b=vp[j];
      double dis = abs(b-a);
      Vector v = (b-a)/dis;
      if(dis-w < eps)cand.pb(v);
      else {
        cand.pb(rotate(Point(0,0),v,acos(w/dis)/pi*180.0));
        cand.pb(rotate(Point(0,0),v,360.0-acos(w/dis)/pi*180.0));
      }
      if(dis-h < eps)cand.pb(v);
      else {
        cand.pb(rotate(Point(0,0),v,acos(h/dis)/pi*180.0));
        cand.pb(rotate(Point(0,0),v,360.0-acos(h/dis)/pi*180.0));
      }
    }
  }
  FOR(i,0,cand.size())
    if(check(cand[i]))return "Yes";
  return "No";
}

int main()
{
  cin>>N>>H>>W>>R;
  FOR(i,0,N){
    double x,y;
    cin>>x>>y;
    vp.pb(Point(x,y));
  }
  cout<<solve()<<endl;
  return 0;
}
accuracy: 1
time_ms: 60
memory_kb: 4468
final_rank: 3

code_snippet: #include<bits/stdc++.h>
#define inf (1e12)
#define eps (1e-5)
#define Eps (1e-15)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pdouble(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

class Point{
public:
  double x,y;
  Point(double x=0,ld y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ 
    return equals(x,p.x) ? y-p.y<-eps : x-p.x<-eps; }
  bool operator==(Point p)const{ 
    return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
  bool operator==(Segment s)const{
    if(s.p1==p1 && s.p2==p2)return true;
    if(s.p2==p1 && s.p1==p2)return true;
    return false;
  }
};
typedef Segment Line;


double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}

Point project(Segment s,Point p){
  Vector base=(s.p2-s.p1);
  double r=(dot(p-s.p1,base)/base.norm());
  return (s.p1+base*r);
}

int ccw(Point p0,Point p1,Point p2){
  Vector a=p1-p0;
  Vector b=p2-p0;
  if(cross(a,b)>eps)return 1;
  if(cross(a,b)<-eps)return -1;
  if(dot(a,b)<-eps)return 2;
  if(a.norm()<b.norm())return -2;
  return 0;
}

Point rotate(Point base,Point a,double r){
  Point b=a-base;
  a.x=b.x*cos((r/180.0l)*pi)-b.y*sin((r/180.0l)*pi);
  a.y=b.x*sin((r/180.0l)*pi)+b.y*cos((r/180.0l)*pi);
  a=a+base;
  return a;
}

int contains(Polygon g,Point p){
  int n=g.size();
  bool x=false;
  for(int i=0;i<n;i++){
    Vector a=g[i]-p,b=g[(i+1)%n]-p;
    if(abs(cross(a,b))<eps && dot(a,b)<eps)return 1;
    if(a.y>b.y)swap(a,b);
    if(a.y<eps && eps<b.y && cross(a,b)>eps)x=!x;
  }
  if(x)return 2;
  return 0;
}

int N;
double H,W,R;
double h,w,hw;
Point o = Point(0,0);
vector<Point> vp;
vector<Vector> cand;

bool check(Vector v){
  Line L = Line(o,v);
  double w1=0,w2=inf,w3=inf,w4=0,sumw = 0;
  double h1=0,h2=inf,h3=inf,h4=0,sumh = 0;
  FOR(i,0,N){
    Point p = project(L,vp[i]);
    double dis = abs(p);
    if(ccw(o,v,p)==2){
      if(dis-w3<-eps)w3 = dis;
      if(w4-dis<-eps)w4 = dis;
    }
    else {
      if(dis-w2<-eps)w2 = dis;
      if(w1-dis<-eps)w1 = dis;
    }
    dis = abs(vp[i]-p);
    if(ccw(o,w,vp[i])==1){
      if(dis-h3<-eps)h3 = dis;
      if(h4-dis<-eps)h4 = dis;
    }
    else{
      if(dis-h2<-eps)h2 = dis;
      if(h1-dis<-eps)h1 = dis;
    }
  }
  if(w4!=0)sumw+=w4;
  if(w3==inf)sumw-=w2;
  if(w1!=0)sumw+=w1;
  if(w2==inf)sumw-=w3;

  if(h4!=0)sumh+=h4;
  if(h3==inf)sumh-=h2;
  if(h1!=0)sumh+=h1;
  if(h2==inf)sumh-=h3;

  if(sumh-h<eps && sumw-w<eps)return true;
  if(sumh-w<eps && sumw-h<eps)return true;
  return false;
}

string solve(){
  if(N==1){
    if(2.0*R-H<eps && 2.0*R-W<eps)return "Yes";
    return "No";
  }
  h = (H-R-R),w = (W-R-R); 
  FOR(i,0,vp.size()){
    FOR(j,0,vp.size()){
      if(i==j)continue;
      Point a=vp[i],b=vp[j];
      double dis = abs(b-a);
      Vector v = (b-a)/dis;
      if(dis-w < eps)cand.pb(v);
      else {
        cand.pb(rotate(Point(0,0),v,acos(w/dis)/pi*180.0));
        cand.pb(rotate(Point(0,0),v,360.0-acos(w/dis)/pi*180.0));
      }
      if(dis-h < eps)cand.pb(v);
      else {
        cand.pb(rotate(Point(0,0),v,acos(h/dis)/pi*180.0));
        cand.pb(rotate(Point(0,0),v,360.0-acos(h/dis)/pi*180.0));
      }
    }
  }
  FOR(i,0,cand.size()){
    if(check(cand[i]))return "Yes";
  }
  return "No";
}

int main()
{
  cin>>N>>H>>W>>R;
  FOR(i,0,N){
    double x,y;
    cin>>x>>y;
    vp.pb(Point(x,y));
  }
  cout<<solve()<<endl;
  return 0;
}
accuracy: 0.7777777777777778
time_ms: 60
memory_kb: 4220
final_rank: 4

code_snippet: #include<bits/stdc++.h>
#define inf 1<<29
#define linf (1e16)
#define eps (1e-8)
#define Eps (1e-15)
#define mod 1000000007
#define pi acos(-1.0)
#define phi (1.0+sqrt(5.0))/2.0
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define pd(a) printf("%.10f\n",(double)(a))
#define pdouble(a) printf("%.10Lf\n",(ld)(a))
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(a)-1;(b)<=i;i--)
#define Unique(v) v.erase(unique(all(v)),v.end())
#define equals(a,b) (fabs((a)-(b))<eps)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<int,double> pid;
typedef pair<double,int> pdi;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<pii> vpi;

class Point{
public:
  double x,y;
  Point(double x=0,ld y=0):x(x),y(y){}

  Point operator+(Point p){ return Point(x+p.x,y+p.y);}
  Point operator-(Point p){ return Point(x-p.x,y-p.y);}
  Point operator*(double k){ return Point(x*k,y*k);}
  Point operator/(double k){ return Point(x/k,y/k);}
  bool operator<(Point p)const{ 
    return equals(x,p.x) ? y-p.y<-eps : x-p.x<-eps; }
  bool operator==(Point p)const{ 
    return fabs(x-p.x)<eps && fabs(y-p.y)<eps;}

  double abs(){ return sqrt(norm());}
  double norm(){ return (x*x+y*y);}
};
typedef Point Vector;
typedef vector<Point> Polygon;

class Segment{
public:
  Point p1,p2;
  Segment(Point p1=Point(),Point p2=Point()):p1(p1),p2(p2){}
  bool operator==(Segment s)const{
    if(s.p1==p1 && s.p2==p2)return true;
    if(s.p2==p1 && s.p1==p2)return true;
    return false;
  }
};
typedef Segment Line;


double norm(Vector a){ return (a.x*a.x+a.y*a.y);}
double abs(Vector a){ return sqrt(norm(a));}
double dot(Vector a,Vector b){ return (a.x*b.x+a.y*b.y);}
double cross(Vector a,Vector b){ return (a.x*b.y-a.y*b.x);}

Point project(Segment s,Point p){
  Vector base=(s.p2-s.p1);
  double r=(dot(p-s.p1,base)/base.norm());
  return (s.p1+base*r);
}

int ccw(Point p0,Point p1,Point p2){
  Vector a=p1-p0;
  Vector b=p2-p0;
  if(cross(a,b)>eps)return 1;
  if(cross(a,b)<-eps)return -1;
  if(dot(a,b)<-eps)return 2;
  if(a.norm()<b.norm())return -2;
  return 0;
}

Point rotate(Point base,Point a,double r){
  Point b=a-base;
  a.x=b.x*cos((r/180.0l)*pi)-b.y*sin((r/180.0l)*pi);
  a.y=b.x*sin((r/180.0l)*pi)+b.y*cos((r/180.0l)*pi);
  a=a+base;
  return a;
}

int contains(Polygon g,Point p){
  int n=g.size();
  bool x=false;
  for(int i=0;i<n;i++){
    Vector a=g[i]-p,b=g[(i+1)%n]-p;
    if(abs(cross(a,b))<eps && dot(a,b)<eps)return 1;
    if(a.y>b.y)swap(a,b);
    if(a.y<eps && eps<b.y && cross(a,b)>eps)x=!x;
  }
  if(x)return 2;
  return 0;
}

int N;
double H,W,R;
double h,w,hw;
Point o = Point(0,0);
vector<Point> vp;
vector<Vector> cand;

bool check(Vector v){
  Line L = Line(o,v);
  double w1=0,w2=inf,w3=inf,w4=0,sumw = 0;
  double h1=0,h2=inf,h3=inf,h4=0,sumh = 0;
  FOR(i,0,N){
    Point p = project(L,vp[i]);
    double dis = abs(p);
    if(ccw(o,v,p)==2){
      if(dis-w3<-eps)w3 = dis;
      if(w4-dis<-eps)w4 = dis;
    }
    else {
      if(dis-w2<-eps)w2 = dis;
      if(w1-dis<-eps)w1 = dis;
    }
    dis = abs(vp[i]-p);
    if(ccw(o,w,vp[i])==1){
      if(dis-h3<-eps)h3 = dis;
      if(h4-dis<-eps)h4 = dis;
    }
    else{
      if(dis-h2<-eps)h2 = dis;
      if(h1-dis<-eps)h1 = dis;
    }
  }
  if(w4!=0)sumw+=w4;
  if(w3==inf)sumw-=w2;
  if(w1!=0)sumw+=w1;
  if(w2==inf)sumw-=w3;

  if(h4!=0)sumh+=h4;
  if(h3==inf)sumh-=h2;
  if(h1!=0)sumh+=h1;
  if(h2==inf)sumh-=h3;

  if(sumh-h<eps && sumw-w<eps)return true;
  if(sumh-w<eps && sumw-h<eps)return true;
  return false;
}

string solve(){
  if(N==1){
    if(2.0*R-H<eps && 2.0*R-W<eps)return "Yes";
    return "No";
  }
  h = (H-R-R),w = (W-R-R); 
  FOR(i,0,vp.size()){
    FOR(j,0,vp.size()){
      if(i==j)continue;
      Point a=vp[i],b=vp[j];
      double dis = abs(b-a);
      Vector v = (b-a)/dis;
      if(dis-w < -eps){
        cand.pb(v);
      }
      else {
        cand.pb(rotate(Point(0,0),v,acos(w/dis)/pi*180.0));
        cand.pb(rotate(Point(0,0),v,360.0-acos(w/dis)/pi*180.0));
      }
      if(dis-h < eps)cand.pb(v);
      else {
        cand.pb(rotate(Point(0,0),v,acos(h/dis)/pi*180.0));
        cand.pb(rotate(Point(0,0),v,360.0-acos(h/dis)/pi*180.0));
      }
    }
  }
  FOR(i,0,cand.size()){
    if(check(cand[i]))return "Yes";
  }
  return "No";
}

int main()
{
  cin>>N>>H>>W>>R;
  FOR(i,0,N){
    double x,y;
    cin>>x>>y;
    vp.pb(Point(x,y));
  }
  cout<<solve()<<endl;
  return 0;
}
accuracy: 0.7777777777777778
time_ms: 70
memory_kb: 4192
final_rank: 5