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

Submission #242685

Source Code Expand

Copy
```#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>

using namespace std;

#define rep(i,j) REP((i), 0, (j))
#define REP(i,j,k) for(int i=(j);(i)<(k);++i)
#define BW(a,x,b) ((a)<=(x)&&(x)<=(b))
#define ALL(v) (v).begin(), (v).end()
#define LENGTHOF(x) (sizeof(x) / sizeof(*(x)))
#define AFILL(a, b) fill((int*)a, (int*)(a + LENGTHOF(a)), b)
#define MP make_pair
#define PB push_back
#define F first
#define S second
#define INF 1 << 30
#define EPS 1e-10

typedef pair<int, int> pi;
typedef pair<int, pi> pii;
typedef vector<int> vi;
typedef queue<int> qi;
typedef long long ll;

int bs(int A, int B, int C, int D){
if(A < B) swap(A, B);
if(C < D) swap(C, D);

if(A <= C && B <= D) return 1;

double l = 0;
double h = M_PI/2;
for(int i = 0; i < 100; i++){
double mid = (l+h)/2;
double height = A*sin(mid) + B*cos(mid);
double width = A*cos(mid) + B*cos(mid);
if(height <= C){
l = mid;
if(width <= C) return 1;
}else{
h = mid;
}
}
return 0;
}

int main(){
int A, B, N, C, D;

scanf("%d%d%d", &A, &B, &N);
rep(i, N){
scanf("%d%d", &C, &D);

if(bs(A, B, C, D)) puts("YES");
else puts("NO");
}
return 0;
}
```

#### Submission Info

Submission Time 2014-09-28 01:38:09+0900 B - 高橋君と禁断の書 raven38 C++ (G++ 4.6.4) 0 1414 Byte WA 58 ms 924 KB

#### Compile Error

```./Main.cpp: In function ‘int main()’:
./Main.cpp:61:30: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
./Main.cpp:63:26: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
```

#### Test Cases

Set Name Score / Max Score Test Cases
Case Name Status Exec Time Memory