Submission #242078


Source Code Expand

Copy
#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <cassert>
#include <memory>
#include <time.h>
using namespace std;
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXIST2(s,e) (find(ALL(s),(e))!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
const double EPS = 1e-9;
const double PI  = acos(-1.0);

int main(){
	int h,w;
	cin>>h>>w;
	int n;
	cin>>n;
	if(h<w){
		swap(h,w);
	}
	REP(i,n){
		int H,W;
		cin>>H>>W;
		if(H<W){
			swap(H,W);
		}
		if(h<=H&&w<=W){
			cout<<"YES"<<endl;
		}else if(h>H&&w>W){
			cout<<"NO"<<endl;
		}else{
			double lb=0,ub=PI/2;
			REP(j,500){
				double mid=(lb+ub)/2;
				if(w*sin(mid)+h*cos(mid)<H){
					ub=mid;
				}else{
					lb=mid;
				}
			}
			if(w*cos(ub)+h*sin(ub)<W+EPS){
				cout<<"YES"<<endl;
			}else{
				cout<<"NO"<<endl;
			}
		}
	}
}

Submission Info

Submission Time
Task B - 高橋君と禁断の書
User SSJJ
Language C++ (G++ 4.6.4)
Score 100
Code Size 1586 Byte
Status
Exec Time 163 ms
Memory 924 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
× 1
× 31
Set Name Test Cases
Sample subtask0-sample-01.txt
All subtask0-sample-01.txt, subtask1-01.txt, subtask1-02.txt, subtask1-03.txt, subtask1-04.txt, subtask1-05.txt, subtask1-06.txt, subtask1-07.txt, subtask1-08.txt, subtask1-09.txt, subtask1-10.txt, subtask1-11.txt, subtask1-12.txt, subtask1-13.txt, subtask1-14.txt, subtask1-15.txt, subtask1-16.txt, subtask1-17.txt, subtask1-18.txt, subtask1-19.txt, subtask1-20.txt, subtask1-21.txt, subtask1-22.txt, subtask1-23.txt, subtask1-24.txt, subtask1-25.txt, subtask1-26.txt, subtask1-27.txt, subtask1-28.txt, subtask1-29.txt, subtask1-30.txt
Case Name Status Exec Time Memory
subtask0-sample-01.txt 27 ms 796 KB
subtask1-01.txt 24 ms 796 KB
subtask1-02.txt 35 ms 672 KB
subtask1-03.txt 89 ms 800 KB
subtask1-04.txt 69 ms 796 KB
subtask1-05.txt 83 ms 804 KB
subtask1-06.txt 119 ms 800 KB
subtask1-07.txt 76 ms 800 KB
subtask1-08.txt 95 ms 924 KB
subtask1-09.txt 130 ms 800 KB
subtask1-10.txt 126 ms 800 KB
subtask1-11.txt 91 ms 796 KB
subtask1-12.txt 73 ms 804 KB
subtask1-13.txt 99 ms 676 KB
subtask1-14.txt 145 ms 736 KB
subtask1-15.txt 96 ms 800 KB
subtask1-16.txt 143 ms 920 KB
subtask1-17.txt 115 ms 796 KB
subtask1-18.txt 101 ms 800 KB
subtask1-19.txt 142 ms 668 KB
subtask1-20.txt 145 ms 668 KB
subtask1-21.txt 163 ms 800 KB
subtask1-22.txt 76 ms 808 KB
subtask1-23.txt 118 ms 800 KB
subtask1-24.txt 130 ms 800 KB
subtask1-25.txt 110 ms 672 KB
subtask1-26.txt 114 ms 924 KB
subtask1-27.txt 119 ms 800 KB
subtask1-28.txt 110 ms 748 KB
subtask1-29.txt 122 ms 800 KB
subtask1-30.txt 82 ms 920 KB