Problem:
Problem H:
Sky Jump
Dr. Kay Em, a genius scientist, developed a new missile named "Ikan-no-i." This missile has
N
jet engines. When the
i
-th engine is ignited, the missile's velocity changes to (
vx
i
,
vy
i
) immediately.
Your task is to determine whether the missile can reach the given target point (
X
,
Y
). The missile can be considered as a mass point in a two-dimensional plane with the
y
-axis pointing up, affected by the gravity of 9.8 downward (i.e. the negative
y
-direction) and initially set at the origin (0, 0). The engines can be ignited at any time in any order. Still, note that at least one of them needs to be ignited to get the missile launched.
Input
The input consists of multiple datasets. Each dataset has the following format.
N
vx
1
vy
1
vx
2
vy
2
...
vx
N
vy
N
X Y
All values are integers and meet the following constraints: 1 ≤
N
≤ 1,000, 0 <
vx
i
≤ 1,000, -1,000 ≤
vy
i
≤ 1,000, 0 <
X
≤ 1,000, -1,000 ≤
Y
≤ 1,000.
The end of input is indicated by a line with a single zero.
Output
For each dataset, output whether the missile can reach the target point in a line: "
Yes
" if it can, "
No
" otherwise.
Sample Input
1
1 1
10 -480
2
6 7
5 5
4 1
3
10 5
4 4
8 4
2 0
0
Output for the Sample Input
Yes
Yes
No

Submitted solutions:

code_snippet: #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>

#define MAXN 1005
#define EPS 1e-8

const double g = 9.8;

int n;
struct Point {
	double x, y;
}p[MAXN];
double X, Y;

bool cmp(Point a, Point b) {
	return a.y * b.x > a.x * b.y;
}

int main() {
	//freopen("/home/christinass/code/in.txt","r",stdin);
	while (scanf("%d", &n) && n) {
		for (int i=1; i<=n; i++) 
			scanf("%lf%lf", &p[i].x, &p[i].y);
		scanf("%lf%lf", &X, &Y);
		
		std::sort(p+1, p+n+1, cmp);

		int num = n;
		for (int i=2; i<=n; i++) {
			double ex = p[i].x;
			double ey = p[i].y;
			double tmpX = 0.0;
			for (int j=1; j<i; j++) {
				double t = (ex * p[j].y - ey * p[j].x) / ex / g;
				tmpX += p[j].x * t;
			}
			if (tmpX > X) {
				num = i-1;
				break;
			}
		}

		double l = -1e9, r = 1e9;
		while (l + 1e-9 < r) {
			double mid = (l + r) / 2;
			double tmpX = 0.0;
			for (int i=1; i<=num; i++) {
				double t = (p[i].y - mid * p[i].x) / g;
				tmpX += p[i].x * t;
			}
			if (tmpX < X) r = mid;
			else l = mid;
		}
		double mid = (l + r) / 2;
		double ymin=1e10, ymax = 0.0;
		for (int i=1; i<=num; i++) {
			double t = (p[i].y - mid * p[i].x) / g;
			ymax += p[i].y * t - g / 2 * t * t;
		}
		for (int i=1; i<=n; i++) {
			double t = X / p[i].x;
			double tmp = p[i].y * t - g / 2 * t * t;
			ymin = std::min(ymin, tmp);
		}
//		printf("%f %f\n", ymin, ymax);
		if (ymin - EPS < Y && ymax + EPS > Y)
			printf("Yes\n");
		else
			printf("No\n");
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 2808
final_rank: 6

code_snippet: #include <bits/stdc++.h>
using namespace std;
using ll = long long;

const double g=-9.8;
const double EPS=1e-8;

void solve(int N){
    vector<double> VX(N),VY(N),V(N);
    for(int i=0;i<N;i++){
        cin>>VX[i]>>VY[i];
        V[i]=sqrt(VX[i]*VX[i]+VY[i]*VY[i]);
    }
    double X,Y;
    cin>>X>>Y;

    double ly=1e18,hy,ok=1e9,ng=-1e9;;
    for(int i=0;i<N;i++){
        double t=X/VX[i];
        ly=min(ly,VY[i]*t+g*t*t/2.0);
    }
    
    for(int i=0;i<100;i++){
        double mid=(ok+ng)/2.0,hx=0.0;
        hy=0.0;
        for(int n=0;n<N;n++){
            double t=(VX[n]*mid-VY[n])/g;
            if(t<0)continue;
            hx+=t*VX[n];
            hy+=VY[n]*t+g*t*t/2.0;
        }
        if(hx<X)ok=mid;
        else ng=mid;
    }
    cout<<(ly-EPS<Y&&Y<hy+EPS?"Yes":"No")<<endl;
}

int main() {
    int N;
    while(cin>>N,N!=0)solve(N);   
}
accuracy: 1
time_ms: 10
memory_kb: 3400
final_rank: 12

code_snippet: #include <bits/stdc++.h>
using namespace std;

template<class T>
bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0;}

using ll = long long;
using ld = long double;

const ld g = 9.8;
const ld EPS = 1e-9;

ll N;
vector<array<ld, 2>> vel;
ld X, Y;

ld get_min() {
  ld ret = 1e18;
  for (int i = 0; i < N; ++i) {
    auto [vx, vy] = vel[i];
    ld t = X / vx;
    ld y = vy * t - g * t * t / 2;
    chmin(ret, y);
  }
  return ret;
}

ld get_max() {
  // lagrange multiplier
  ld posi = -1e9;
  ld nega = 1e9;
  for (int c = 0; c < 100; ++c) {
    ld mid = (posi + nega) / 2;
    ld f = 0.0;
    for (int i = 0; i < N; ++i) {
      auto [vx, vy] = vel[i];
      ld t = max( (vy - mid * vx) / g, ld(0.0) );
      f += vx * t;
    }
    f -= X;
    
    if (f >= 0.0) posi = mid;
    else nega = mid;
  }
  
  ld ret = 0.0;
  for (int i = 0; i < N; ++i) {
    auto [vx, vy] = vel[i];
    ld t = max( (vy - posi * vx) / g, ld(0.0) );
    ret += vy * t - g * t * t / 2;
  }
  
  return ret;
}

void solve() {
  cin >> N;
  if (N == 0) {
    exit(0);
  }
  vel.resize(N);
  for (int i = 0; i < N; ++i) {
    ld vx, vy; cin >> vx >> vy;
    vel[i] = {vx, vy};
  }
  cin >> X >> Y;
  
  ld mn = get_min();
  ld mx = get_max();
  
  if (mn - EPS < Y && Y < mx + EPS) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return;
}



int main() {
  while (1) {
    solve();
  }
  
  return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3712
final_rank: 16

code_snippet: #include <iostream>
#include <algorithm>
using namespace std;

const long double EPS = 0.000000000001L;
int N;
long double vx[1009], vy[1009], A[1009], B[1009];
long double X, Y;

void solve() {
	long double Max = -1000000.0L, Min = 1000000.0L;

	// Min を計算する
	for (int i = 1; i <= N; i++) Min = min(Min, -A[i] * X * X + B[i] * X);

	// Max を計算する
	long double cl = -1000000.0L, cr = 1000000.0L, cm;
	for (int loop = 1; loop <= 90; loop++) {
		cm = (cl + cr) / 2.0;
		long double sum = 0.0L, score = 0.0L;
		for (int i = 1; i <= N; i++) {
			long double zahyou = max(0.0L, (B[i] + cm) / (2.0L * A[i]));
			sum += zahyou;
			score += -A[i] * zahyou * zahyou + B[i] * zahyou;
		}
		if (sum < X) { cl = cm; }
		else { cr = cm; }
		Max = score;
	}

	// 判定を行う
	if (Min - EPS <= Y && Y <= Max + EPS) cout << "Yes" << endl;
	else cout << "No" << endl;
}

int main() {
	while (true) {
		cin >> N; if (N == 0) break;
		for (int i = 1; i <= N; i++) {
			cin >> vx[i] >> vy[i];
			A[i] = 4.9L / (vx[i] * vx[i]);
			B[i] = vy[i] / vx[i];
		}
		cin >> X >> Y;
		solve();
	}
	return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3564
final_rank: 15

code_snippet: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return true; } return false; }
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define mp make_pair
#define si(x) int(x.size())
const int mod=998244353,MAX=300005,INF=1<<28;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    while(1){
        int N;cin>>N;
        if(N==0) break;
        vector<double> X(N),Y(N);
        for(int i=0;i<N;i++) cin>>X[i]>>Y[i];
        double xx,yy;cin>>xx>>yy;
        double left=-1e20,right=-1e20;
        for(int i=0;i<N;i++){
            chmax(right,Y[i]/X[i]);
        }
        double ma=-1e20;
        for(int q=0;q<200;q++){
            double mid=(left+right)/2;
            double sum=0,sumy=0;
            for(int i=0;i<N;i++){
                if(Y[i]/X[i]<mid) continue;
                double ty=mid*X[i];
                double t=(Y[i]-ty)/9.8;
                sum+=X[i]*t;
                sumy+=Y[i]*t-4.9*t*t;
            }
            if(sum>=xx){
                left=mid;
            }else{
                right=mid;
            }
            //cout<<mid<<" "<<sum<<" "<<sumy<<endl;
            
            ma=sumy;
        }
        
        //cout<<left<<" ";
        
        double mi=1e50;
        for(int i=0;i<N;i++){
            double t=xx/X[i];
            chmin(mi,Y[i]*t-4.9*t*t);
        }
        
        //cout<<mi<<" "<<ma<<endl;
        
        if(mi-(1e-10)<=yy&&yy<=ma+(1e-10)) cout<<"Yes\n";
        else cout<<"No\n";
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3544
final_rank: 14

code_snippet: #include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    while (cin >> N, N) {
        vector<pair<double, double>> V(N);
        for (int i = 0; i < N; i++) {
            cin >> V[i].first >> V[i].second;
        }
        double X, Y;
        cin >> X >> Y;
        const double g = 9.8, EPS = 1e-10;
        auto check = [&](double tilt) {
            double x = 0;
            for (auto&& [vx, vy] : V) {
                double tilt_initial = 1.0 * vy / vx;
                if (tilt_initial <= tilt)
                    continue;
                double t = (1.0 * vy - tilt * vx) / g;
                x += t * vx;
            }
            return x <= X;
        };
        double ok = 1e10;
        double ng = -1e10;
        while (abs(ok - ng) > EPS) {
            double mid = (ok + ng) / 2;
            if (check(mid)) {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        double tilt = ok;
        double YMAX = 0;
        for (auto&& [vx, vy] : V) {
            double t = (1.0 * vy - tilt * vx) / g;
            if (t >= 0)
                YMAX += t * vy - 1.0 / 2.0 * t * t * g;
        }
        double YMIN = YMAX;
        for (auto&& [vx, vy] : V) {
            double t = 1.0 * X / vx;
            YMIN = min(YMIN, t * vy - 1.0 / 2.0 * t * t * g);
        }
        cout << ((YMIN - EPS <= Y && Y <= YMAX + EPS) ? "Yes" : "No") << endl;
    }
}
accuracy: 1
time_ms: 10
memory_kb: 3440
final_rank: 13

code_snippet: #include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 1005

struct Info{
	double v_x,v_y;
};

int N;
Info info[NUM];
double X,Y;
double g;

double calc_height(double v_y,double t){

	return v_y*t-g*t*t/2.0;
}

void func(){

	for(int i = 0; i < N; i++){
		scanf("%lf %lf",&info[i].v_x,&info[i].v_y);
	}
	scanf("%lf %lf",&X,&Y);

	double minimum = (double)BIG_NUM;

	for(int i = 0; i < N; i++){
		minimum = min(minimum,calc_height(info[i].v_y,X/info[i].v_x));
	}

	if(minimum > Y+EPS){
		printf("No\n");
		return;
	}

	double left = -BIG_NUM,right = BIG_NUM,mid = (left+right)/2;
	double tmp_x,tmp_y,tmp_t;

	for(int i = 0; i < 100; i++){

		tmp_x = 0;
		tmp_y = 0;

		for(int k = 0; k < N; k++){
			tmp_t = (info[k].v_y-mid*info[k].v_x)/g;
			if(tmp_t < 0)continue;

			tmp_x += info[k].v_x*tmp_t;
			tmp_y += calc_height(info[k].v_y,tmp_t);
		}

		if(tmp_x+EPS < X){

			right = mid-EPS;

		}else{

			left = mid+EPS;

		}
		mid = (left+right)/2.0;
	}

	if(tmp_y >= Y){

		printf("Yes\n");

	}else{

		printf("No\n");
	}
}

int main(){

	g = 9.8;

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3276
final_rank: 11

code_snippet: #include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007
#define eps 1e-8

int N;
double vx[1001],vy[1001];
double X,Y;
const double g=9.8;

double calc(double vxi,double vyi,double y0,double t1){
  return (-1.0/2.0)*g*t1*t1+vyi*t1+y0;
}

int main(){
  while(1){
    cin>>N;
    if(N==0)break;
    rep(i,N)cin>>vx[i]>>vy[i];
    cin>>X>>Y;
    bool ok=false;
    rep(i,N){
      double t1=X/vx[i];
      if(calc(vx[i],vy[i],0,t1)<Y+eps)ok=true;
    }
    if(!ok){
      cout<<"No"<<endl;
      continue;
    }
    double lb=-1e9,ub=1e9;
    double crtx,crty;
    rep(_,100){
      double D=(lb+ub)/2;
      crtx=0,crty=0;
      rep(i,N){
        double t1=(D-(vy[i]/vx[i]))/(-g/vx[i]);
        if(t1<0)t1=0;
        crtx+=vx[i]*t1;
        crty=calc(vx[i],vy[i],crty,t1);
      }
      if(crtx<X)ub=D;
      else lb=D;
    }
    //dbg(crty);
    if(crty>Y-eps){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }

  return 0;
}
accuracy: 1
time_ms: 40
memory_kb: 3088
final_rank: 7

code_snippet: #include<bits/stdc++.h>
using namespace std;
using Int = long long;
using Double = long double;

template<typename T1,typename T2> void chmin(T1 &a,T2 b){if(a>b) a=b;};
template<typename T1,typename T2> void chmax(T1 &a,T2 b){if(a<b) a=b;};

signed main(){
  Int n;
  const Double EPS = 1e-8;
  Int cnt=0;
  while(cin>>n,n){
    ++cnt;
    vector<Double> vx(n),vy(n);
    for(Int i=0;i<n;i++) cin>>vx[i]>>vy[i];

    const Double g=9.8;
    auto calc=[&](Int i,Double x){    
      Double t=x/vx[i];
      return vy[i]*t-g/2.0*t*t;    
    };

    Double x,y;
    cin>>x>>y;
  
    Double lb=calc(0,x);
    for(Int i=0;i<n;i++) chmin(lb,calc(i,x));
    if(y+EPS<lb){
      cout<<"No"<<endl;
      continue;
    }
    
    auto check=[&](Double m)->Double{
      Double res=0;
      for(Int i=0;i<n;i++){
	if(vy[i]<m*vx[i]) continue;
	res+=vx[i]*(vy[i]-m*vx[i])/9.8;
      }
      return res+EPS;
    };
    auto check2=[&](Double m)->Double{
      Double res=0;
      for(Int i=0;i<n;i++){
	if(vy[i]<m*vx[i]) continue;
	res+=calc(i,vx[i]*(vy[i]-m*vx[i])/9.8);
      }
      return res;
    };
    Double l=-1e9,r=1e9;
    for(Int k=0;k<100;k++){
      Double m=(l+r)/2;
      if(x<=check(m)) l=m;
      else r=m;
    }
    //cout<<l<<":"<<check(l)<<":"<<check2(l)<<endl;
    cout<<(y<=check2(l)?"Yes":"No")<<endl; 
  }
  
  return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3196
final_rank: 8

code_snippet: #include<bits/stdc++.h>
using namespace std;
using Int = long long;
using Double = long double;

template<typename T1,typename T2> void chmin(T1 &a,T2 b){if(a>b) a=b;};
template<typename T1,typename T2> void chmax(T1 &a,T2 b){if(a<b) a=b;};

signed main(){
  Int n;
  const Double EPS = 1e-8;
  Int cnt=0;
  while(cin>>n,n){
    ++cnt;
    vector<Double> vx(n),vy(n);
    for(Int i=0;i<n;i++) cin>>vx[i]>>vy[i];

    const Double g=9.8;
    auto calc=[&](Int i,Double x){    
      Double t=x/vx[i];
      return vy[i]*t-g/2.0*t*t;    
    };

    Double x,y;
    cin>>x>>y;
  
    Double lb=calc(0,x);
    for(Int i=0;i<n;i++) chmin(lb,calc(i,x));
    if(y+EPS<lb){
      cout<<"No"<<endl;
      continue;
    }
    
    auto check=[&](Double m)->Double{
      Double res=0;
      for(Int i=0;i<n;i++){
	if(vy[i]<m*vx[i]) continue;
	res+=vx[i]*(vy[i]-m*vx[i])/9.8;
      }
      return res+EPS;
    };
    auto check2=[&](Double m)->Double{
      Double res=0;
      for(Int i=0;i<n;i++){
	if(vy[i]<m*vx[i]) continue;
	res+=calc(i,vx[i]*(vy[i]-m*vx[i])/9.8);
      }
      return res;
    };
    Double l=-1e9,r=1e9;
    for(Int k=0;k<100;k++){
      Double m=(l+r)/2;
      if(x<=check(m)) l=m;
      else r=m;
    }
    //cout<<l<<":"<<check(l)<<":"<<check2(l)<<endl;
    cout<<(y<=check2(l)?"Yes":"No")<<endl; 
  }
  
  return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 3204
final_rank: 9

code_snippet: #include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld=long double;

string st;
int a;

int get_num() {
	int num=0;
	while (a != st.size() && isdigit(st[a])) {
		num*=10;
		num+=st[a]-'0';
		a++;
	}
	return num;
}
vector<int>expr();
vector<int>prim() {
	if (st[a] == '(') {
		a++;
		vector<int>v=expr();
		assert(st[a]==')');
		a++;
		return v;
	}
	else {
		if (st[a] == 'x') {
			a++;
			return vector<int>{1, 0};
		}
		else {
			return vector<int>{get_num()};
		}
	}
}
vector<int> operator+(const vector<int>l, const vector<int>r) {
	vector<int>v(max(l.size(),r.size()));
	int k=max(l.size(),r.size());
	for (int i = 0; i < l.size(); ++i) {
		v[i+k-l.size()]+=l[i];
	}
	for (int j = 0; j < r.size(); ++j) {
		v[j+k-r.size()]+=r[j];
	}
	return v;
}
vector<int> operator*(const vector<int>l, const vector<int>r) {
	vector<int>v(l.size()+r.size()-1);
	for (int i = 0; i < l.size(); ++i) {
		for (int j = 0; j < r.size(); ++j) {
			v[i+j]+=l[i]*r[j];
		}
	}
	return v;
}

vector<int>fact() {
	vector<int>pr(prim());
	if (a != st.size() && st[a] == '^') {
		a++;
		int expo=get_num();

		vector<int>ans{ 1 };
		for (int k = 0; k < expo; ++k) {
			ans=ans*pr;
		}
		return ans;
	}
	else {
		return pr;
	}
}

vector<int>term() {
	vector<int>fa=fact();

	while (a != st.size() && st[a] != '+'&&st[a] != '-'&&st[a] != ')') {
		vector<int>next_fa=fact();
		fa=fa*next_fa;
	}
	return fa;
}
vector<int>expr() {
	vector<int>ter;
	{

		bool minus = false;
		if (st[a] == '-') {
			minus = true;
			a++;
		}
		ter=term();

		if (minus) {
			ter = ter*vector<int>{-1};
		}

	}
	while (a != st.size() &&( st[a] == '+' || st[a] == '-')) {
		bool minus=st[a]=='-';
		a++;
		vector<int>next_ter=term();
		if (minus) {
			next_ter = next_ter*vector<int>{-1};
		}
		ter=ter+next_ter;
	}
	return ter;

}

bool operator<(vector<ld>l, vector<ld>r) {
	if(l.size()!=r.size())return l.size()<r.size();
	for (int i = 0; i < l.size(); ++i) {
		if(abs(l[i])<abs(r[i]))return true;
		else if(abs(l[i])>abs(r[i]))return false;
	}
	return false;
}

int gcd(int a, int b) {
	if(a<0)return gcd(-a,b);
	if(b<0)return gcd(a,-b);
	if(b<a)swap(a,b);
	if(b%a==0)return a;
	else {
		return gcd(b%a,a);
	}
}
int gcd(vector<int>v) {
	int ans=-1;
	for (int i = 0; i < v.size(); ++i) {
		if (v[i]) {
			if(ans==-1)ans=abs(v[i]);
			else ans=gcd(ans,abs(v[i]));
		}
	}
	return ans;
}

vector<ld>solve(vector<ld>l, vector<ld>r) {
	if(r<l)return solve(r,l);
	else {
		vector<ld>ans(r);
		for (int i = 0; i < r.size() - l.size() + 1; ++i) {
			ld num=ans[i]/l[0];

			for (int j = 0; j < l.size(); ++j) {
				ans[i+j]-=num*l[j];
			}
		}
		ans.erase(ans.begin(),find_if_not(ans.begin(), ans.end(), [](const ld a) {return abs(a)<1e-9; }));
		if (ans.empty()) {
			return l;
		}
		else {
			return solve(ans,l);
		}
	}
}

ld get_max_y(vector<pair<ld, ld>>vels, ld X, ld Y) {
	ld amin = -1e9;
	ld amax = 1e9;

	int rest = 100;
	while (rest--) {
		ld amid = (amin + amax) / 2;

		ld x_sum = 0;
		for (auto vel : vels) {
			ld border_vy = vel.first*amid;
			if (border_vy < vel.second) {
				ld time = (vel.second - border_vy) / 9.8;
				x_sum += time*vel.first;
			}
		}

		if (x_sum >= X)amin = amid;
		else amax = amid;
	}
	ld y_sum = 0;
	for (auto vel : vels) {
		ld border_vy = vel.first*amin;
		if (border_vy < vel.second) {
			ld time = (vel.second - border_vy) / 9.8;
			y_sum += (vel.second + border_vy)*time / 2;
		}
	}
	return y_sum;

}

int main() {
	while (true) {
		int N;cin>>N;if(!N)break;
		vector<pair<ld,ld>>vels(N);
		for (int i = 0; i < N; ++i) {
			int a,b;cin>>a>>b;
			vels[i]=make_pair(a,b);
		}
		ld X,Y;cin>>X>>Y;

		
		ld max_y=get_max_y(vels,X,Y);

		ld min_y=1e9;
		for (auto vel : vels) {
			ld time=X/vel.first;
			min_y=min(min_y,time*vel.second-4.9*time*time);
		}
		ld eps=1e-9;
		bool ok=min_y-eps<=Y&&Y<=eps+max_y;
		if(ok)cout<<"Yes"<<endl;
		else cout<<"No"<<endl;
	}
	return 0;
}
accuracy: 1
time_ms: 10
memory_kb: 3228
final_rank: 10

code_snippet: #include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cmath>
#include <complex>
#include <cassert>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define rep1(i,n) for(int i=1;i<=(n);++i)
#define all(c) (c).begin(),(c).end()
#define fs first
#define sc second
#define pb push_back
#define show(x) cout << #x << " " << x << endl
typedef long double D;
typedef pair<D,D> P;
D eps=1e-12,inf=1e50;
vector<P> vc;
int main(){
	while(true){
		int N;
		cin>>N;
		if(N==0) break;
		vc.clear();
		rep(i,N){
			D x,y;
			cin>>x>>y;
			vc.pb(P(y/x,4.9/x/x));
		}
		D X,Y;
		cin>>X>>Y;
		sort(all(vc),greater<P>());
		D ans=-inf;
		rep1(n,N){
			D ub=X,lb=0;
			while(ub-lb>eps){
				D t0=(ub+lb)/2;
				D t=t0;
				rep1(i,n-1){
					D ti=(2*vc[0].sc*t0-vc[0].fs+vc[i].fs)/(2*vc[i].sc);
					t+=ti;
				}
				if(t>X) ub=t0;
				else lb=t0;
			}
			D y=0,tsum=0;
			bool can=true;
			rep(i,n){
				D t=(2*vc[0].sc*ub-vc[0].fs+vc[i].fs)/(2*vc[i].sc);
				if(t<eps) can=false;
				tsum+=t;
				y+=vc[i].fs*t-vc[i].sc*t*t;
			}
			if(can) ans=max(ans,y);
		}
		D lb=inf;
		rep(i,N){
			lb=min(lb,vc[i].fs*X-vc[i].sc*X*X);
		}
		if(lb-5*eps<Y&&Y<ans+5*eps) puts("Yes");
		else puts("No");
	}
}
accuracy: 1
time_ms: 3720
memory_kb: 1260
final_rank: 17

code_snippet: #include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;

typedef double Real;

const Real G=9.8;
const Real inf=1e9;
const Real eps=1e-9;

template<class T> bool eq(T a,T b){
	return abs(a-b)<eps;
}

template<class T> int sgn(T a){
	if(eq(a,0.0)) return 0;
	if(a>0) return 1;
	return -1;
}

Real a[1010],b[1010];

int vx[1010],vy[1010];
int N;

int X,Y;

Real getmin(){
	Real res=inf;
	for(int i=0;i<N;i++){
		Real cur=X*a[i]-X*X*b[i];
		res=min(res,cur);
	}
	return res;
}

Real getMax(){
	Real ub=inf,lb=-inf;
	Real res;
//	for(int i=0;i<N;i++) ub=min(ub,a[i]);
	for(int stage=0;stage<150;stage++){
		Real mid=(ub+lb)/2;
		Real x=0,y=0;
		for(int i=0;i<N;i++){
			if(a[i]<mid) continue;
			Real cx=(a[i]-mid)/(b[i]*2);
			Real cy=a[i]*cx-b[i]*cx*cx;
			x+=cx;y+=cy;
		}
		if(x>X){
			lb=mid;
		}else{
			ub=mid;
		}
		res=y;
	}
	return res;
}

void input(){
	scanf("%d",&N);
	if(N==0) exit(0);
	for(int i=0;i<N;i++){
		scanf("%d%d",vx+i,vy+i);
	}
	scanf("%d%d",&X,&Y);
}

void precalc(){
	for(int i=0;i<N;i++){
		a[i]=(Real)vy[i]/vx[i];
		b[i]=0.5*G/(vx[i]*vx[i]);
	}
}

int main(){
	while(true){
		input();
		precalc();
		Real mi=getmin();
		Real Ma=getMax();
//		printf("%f %f\n",mi,Ma);
		if(sgn(Ma-Y)>=0&&sgn(Y-mi)>=0){
			printf("Yes\n");
		}else{
			printf("No\n");
		}
	}
	return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 1036
final_rank: 2

code_snippet: #include<stdio.h>
#include<math.h>
#include<algorithm>
using namespace std;
double x[1100];
double y[1100];
double eps=1e-9;
int main(){
	int a;
	while(scanf("%d",&a),a){
		for(int i=0;i<a;i++)scanf("%lf%lf",x+i,y+i);
		double gx,gy;scanf("%lf%lf",&gx,&gy);
		double low=999999999;
		for(int i=0;i<a;i++){
			double t=gx/x[i];
			low=min(low,-4.9*t*t+y[i]*t);
		}
		double left=-999999999;
		double right=999999999;
		for(int i=0;i<100;i++){
			double M=(left+right)/2;
			double at=0;
			for(int j=0;j<a;j++){
				if(x[j]*M>y[j])continue;
				double dx=(y[j]/x[j]-M)*(x[j]*x[j]/9.8);
				at+=dx;
			}
			if(at>gx){
				left=M;
			}else{
				right=M;
			}
		}
		double ty=0;
		for(int i=0;i<a;i++){
			if(x[i]*left>y[i])continue;
			double dx=(y[i]/x[i]-left)*(x[i]*x[i]/9.8);
			ty+=-4.9/x[i]/x[i]*dx*dx+y[i]/x[i]*dx;
		}
		//printf("%f %f\n",low,ty);
		if(low-eps<gy&&gy<ty+eps)printf("Yes\n");
		else printf("No\n");
	}
}
accuracy: 1
time_ms: 30
memory_kb: 1064
final_rank: 3

code_snippet: #include<iostream>
#include<cstring>
#include<cstdio>
#include<cmath>
#define eps 1.0e-8
#define INF 1e50
#define g 4.9
using namespace std;
double X,Y;
int n;
struct G{
    double x;
    double y;
};
G d[1010];
double calc(double x)
{
    double ans=0;
    for(int i=0;i<n;i++){
        double t=(x*d[i].x/g+d[i].y/g)/2.0;
        if(t>0) ans+=t*d[i].x;
    }
    return ans;
}
double calcy(double x)
{
    double ans=0;
    for(int i=0;i<n;i++){
        double t=(x*d[i].x/g+d[i].y/g)/2.0;
        if(t>0) ans+=t*d[i].y-g*t*t;
    }
    return ans;
}
double cnt()
{
    double left=-1e4, right=1e4, mid;
    while(left+eps<right){
        mid=left+(right-left)/2.0;
        if(calc(mid)>=X) right=mid;
        else left=mid;
    }
    return calcy(left);
}
int main()
{
    int i,j;
    while(scanf("%d",&n),n)
    {
        for(i=0;i<n;i++) scanf("%lf%lf",&d[i].x,&d[i].y);
        scanf("%lf%lf",&X,&Y);
        //for(i=0;i<n;i++) printf("%lf %lf\n",d[i].x,d[i].y);
        double ymin=INF, ymax=-INF;
        for(i=0;i<n;i++){
            double t1=X/d[i].x, y=d[i].y*t1-g*t1*t1;
            ymin=min(y,ymin);
        }
        double tmp=cnt();
        ymax=max(ymax,tmp);
        //printf("%f %f\n",ymin,ymax);
        if(Y<=ymax+eps&&Y>=ymin-eps) puts("Yes");
        else puts("No");
    }
    return 0;
}
accuracy: 1
time_ms: 30
memory_kb: 1216
final_rank: 4

code_snippet: #include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int,int> pint;

#define DE 1
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#define ALL(s) (s).begin(),(s).end()
#define REP(i,n) for (int i = 0; i < (int)(n); ++i)
#define EACH(i,s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl

template<class T1, class T2> ostream& operator<<(ostream &s, pair<T1,T2> P){return s<<'<'<<P.first<<", "<<P.second<<'>';}
template<class T> ostream& operator<<(ostream &s, vector<T> P) {s<<"{ ";for(int i=0;i<P.size();++i){if(i>0)s<<", ";s<<P[i];}return s<<" }"<<endl;}
template<class T1, class T2> ostream& operator<<(ostream &s, map<T1,T2> P) {s<<"{ ";for(__typeof__(P.begin()) it=P.begin();it!=P.end();++it){if(it!=P.begin())s<<", ";s<<'<'<<it->first<<"->"<<it->second<<'>';}return s<<" }"<<endl;}



typedef double DD;
const DD INF = 1LL<<29;
const DD EPS = 1e-7;
const DD g = 9.8;

struct Para {
	DD f, s, t;
    Para(DD f_ = 0.0, DD s_ = 0.0, DD t_ = 0.0) : f(f_), s(s_), t(t_) {}
};
ostream& operator<<(ostream &s, const Para &p) {
    return s << '<' << p.f << " ; " << p.s << " : " << p.t << '>' << endl;
}
bool operator < (Para p, Para q) {
    return (p.s < q.s);
}
bool operator > (Para p, Para q) {
    return (p.s > q.s);
}

Para makepara(DD vx, DD vy) {
    DD f = -g/2/vx/vx;
    DD s = vy/vx;
    DD t = 0.0;
    return Para(f, s, t);
}

Para envelope(Para p1, Para p2) {
    DD a = p1.f, b = p1.s, c = p1.t;
    DD p = p2.f, q = p2.s, r = p2.t;
    DD f = p*a/(p+a);
    DD s = (p*b+q*a)/(p+a);
    DD t = r+c-(q-b)*(q-b)/4/(p+a);
    return Para(f, s, t);
}

int N;
DD X, Y;
vector<Para> engine;
vector<Para> upline;
vector<pair<DD,DD> > divid;

int main() {
    while (cin >> N) {
        if (N == 0) break;
        
        engine.clear(); upline.clear(); divid.clear();
        for (int i = 0; i < N; ++i) {
            DD vx, vy; cin >> vx >> vy;
            Para p = makepara(vx, vy);
            engine.PB(p);
        }
        cin >> X >> Y;
        
        //COUT(engine);
        sort(ALL(engine), greater<Para>());
        //COUT(engine);
        
        bool isdown = false, isup = false;
        for (int i = 0; i < N; ++i) {
            Para p = engine[i];
            DD h = p.f*X*X + p.s*X + p.t;
            if (Y - h > -EPS) isdown = true;
        }
        
        Para now = engine[0];
        upline.PB(now); divid.PB(MP(0.0, INF));
        for (int i = 1; i < N; ++i) {
            Para p = engine[i];
            DD se = (p.s - now.s)/2/now.f;
            now = envelope(now, p);
            
            upline.PB(now);
            divid[i-1].SE = se;
            divid.PB(MP(se, INF));
        }
        
        //COUT(upline);
        //COUT(divid);
        
        for (int i = 0; i < N; ++i) {
            if (divid[i].FI - EPS < X && X < divid[i].SE + EPS) {
                Para p = upline[i];
                DD h = p.f*X*X + p.s*X + p.t;
                
                //cout << i << " : " << h << endl;
                
                if (h - Y > -EPS) isup = true;
            }
        }
        
        //COUT(isdown); COUT(isup);
         
        if (isdown && isup) cout << "Yes" << endl;
        else cout << "No" << endl;
    }
    
    return 0;
}
accuracy: 1
time_ms: 20
memory_kb: 1312
final_rank: 5

code_snippet: #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

const double G = 9.8;
int n;
double vx[1010];
double vy[1010];
double ex, ey;

// Y  = -G / 2.0 * x^2 / vx^2 + vy * x / vx
// Y' = -G * x / vx^2 + vy / vx
// grad * vx^2 / -G + vy * vx / G = x

double X(double grad) {
  double sum = 0;
  REP(i, n) {
    double x = -grad * vx[i] * vx[i] / -G + vy[i] * vx[i] / G;
    if (x < 0) { continue; }
    sum += x;
  }
  return sum;
}

double Y(double grad) {
  double sum = 0;
  REP(i, n) {
    double x = -grad * vx[i] * vx[i] / -G + vy[i] * vx[i] / G;
    if (x < 0) { continue; }
    double y = -G / 2.0 * x * x / vx[i] / vx[i] + vy[i] * x / vx[i];
    sum += y;
  }
  return sum;
}

int main() {
  while (scanf("%d", &n), n) {
    REP(i, n) {
      scanf("%lf %lf", &vx[i], &vy[i]);
    }
    scanf("%lf %lf", &ex, &ey);
    double infY = 1e+100;
    double supY = -1e+100;
    REP(i, n) {
      double t = ex / vx[i];
      double y = -G / 2.0 * t * t + vy[i] * t;
      infY = min(infY, y);
    }
    {
      double left = -1e+6;
      double right = 1e+6;
      REP(iter, 200) {
        double mid = (left + right) / 2.0;
        if (X(mid) >= ex) {
          right = mid;
        } else {
          left = mid;
        }
      }
      supY = max(supY, Y(left));
    }
    //cout << infY << " "<< supY << " " << ey << endl;
    if (infY - ey <= EPS && -EPS <= supY - ey) {
      puts("Yes");
    } else {
      puts("No");
    }
  }
}
accuracy: 1
time_ms: 130
memory_kb: 896
final_rank: 1