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

Submission #243641

Source Code Expand

Copy
```#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <queue>

#pragma warning( disable: 4996 )

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

#define INF 1000000000
#define EPS 1e-10

#define MAX_A 300000
#define MAX_B 300000

#define MAX_N 5000

#define PI (atan(1.0) * 4.0)

int A, B;
int N;
int C[MAX_N];
int D[MAX_N];

int main() {

cin >> A >> B;

if (A > B)
swap(A, B);

cin >> N;

for (int i = 0; i < N; i++){
cin >> C[i] >> D[i];
if (C[i] > D[i])
swap(C[i], D[i]);
}

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

if ((A <= C[i] && B <= D[i]) || (A <= D[i] && B <= C[i])){
cout << "YES" << endl;
continue;
}

double lb = 0, ub = PI / 2;

bool flag = false;

while (ub - lb > EPS){
double rad = (ub + lb) / 2;
double a = B*sin(rad) + A * cos(rad);
if (a > C[i]){
}
else{
}
}

double d = A * sin(lb) + B * cos(lb);
if (D[i] - d >= 0.01)
cout << "YES" << endl;
else
cout << "NO" << endl;

}

return 0;
}```

#### Submission Info

Submission Time 2014-10-02 00:32:35+0900 B - 高橋君と禁断の書 taketake0609 C++ (G++ 4.6.4) 0 1466 Byte WA 62 ms 932 KB

#### Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0-sample-01.txt
Case Name Status Exec Time Memory
subtask0-sample-01.txt 22 ms 928 KB
subtask1-01.txt 22 ms 804 KB
subtask1-02.txt 27 ms 744 KB
subtask1-03.txt 38 ms 844 KB
subtask1-04.txt 41 ms 796 KB
subtask1-05.txt 46 ms 932 KB
subtask1-06.txt 51 ms 736 KB
subtask1-07.txt 44 ms 924 KB
subtask1-08.txt 49 ms 924 KB
subtask1-09.txt 51 ms 800 KB
subtask1-10.txt 56 ms 928 KB
subtask1-11.txt 50 ms 928 KB
subtask1-12.txt 44 ms 804 KB
subtask1-13.txt 50 ms 932 KB
subtask1-14.txt 53 ms 928 KB
subtask1-15.txt 50 ms 800 KB
subtask1-16.txt 59 ms 796 KB
subtask1-17.txt 48 ms 804 KB
subtask1-18.txt 52 ms 804 KB
subtask1-19.txt 48 ms 844 KB
subtask1-20.txt 52 ms 816 KB
subtask1-21.txt 57 ms 808 KB
subtask1-22.txt 60 ms 736 KB
subtask1-23.txt 55 ms 928 KB
subtask1-24.txt 60 ms 928 KB
subtask1-25.txt 58 ms 916 KB
subtask1-26.txt 57 ms 928 KB
subtask1-27.txt 52 ms 808 KB
subtask1-28.txt 60 ms 924 KB
subtask1-29.txt 60 ms 924 KB
subtask1-30.txt 62 ms 916 KB