Contest Duration: ~ (local time) (90 minutes) Back to Home

Submission #241560

Source Code Expand

Copy
```#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-9;
const int INF = 1<<25;
typedef pair<int,int> P;
typedef long long ll;
typedef unsigned long long ull;

bool check(int A, int B, int C, int D){
if(A<C && B<D) return true;
if(B>D && A<C){
double r1 = 0.0, r2 = PI/2.0;
while(r2-r1>EPS){
double r3 = (r1+r2)/2;
if(B*cos(r3)+A*sin(r3)<=D) r2 = r3;
else r1 = r3;
}
return B*sin(r2)+A*cos(r2)<=C;
}
return false;
}

int main(){
int A, B, N;
cin>>A>>B>>N;
if(A>B) swap(A,B);
for(int i = 0; i < N; i++){
int C, D;
cin>>C>>D;
if(C>D) swap(C,D);
cout<<(check(A,B,C,D)?"YES":"NO")<<endl;
}
return 0;
}
```

Submission Info

Submission Time 2014-09-27 21:31:20+0900 B - 高橋君と禁断の書 Lepton C++ (G++ 4.6.4) 100 1060 Byte AC 55 ms 804 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
 AC × 1
 AC × 31
Set Name Test Cases
Case Name Status Exec Time Memory