Submission #315220


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 SQ(x) ((x)*(x))
#define Mod(x, mod) (((x)+(mod)%(mod))
#define MP make_pair
#define PB push_back
#define Fi first
#define Se second
#define INF (1<<29)
#define EPS 1e-10
#define MOD 1000000007

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

double toRad(double deg){ return deg*M_PI/180.0; }

int A,B,C,D,N;

int main(){
  double h,w;
  //  cin >> h >> w;
  double a = 0;
  h = 1; w = 6;
  //  cout << h*sin(toRad(90-a)) +  w*sin(toRad(a))<< endl;
  //  cout << w*cos(toRad(a)) +  h*cos(toRad(90-a)) << endl;

  cin >> A >> B >> N;

  rep(i,N){
    cin >> C >> D;
    double lb = 0, ub = 90;
    for(int l=0;l<100;l++){
      double mid = (lb+ub)/2.0;
      h = A*sin(toRad(90-mid)) + B*sin(toRad(mid));
      w = A*cos(toRad(90-mid)) + B*cos(toRad(mid));
      //      printf("%.5f %.5f %.5f\n", mid, h, w);
      //      cout << h << " " <<A << " " <<w << " " << B << endl;
      if(h <= C && w <= D){
	cout << "YES\n";
	break;
      }else if(h <= A){
	ub = mid;
      }else{
	lb = mid;
      }

      if(l==99) cout << "NO\n";
    }
  }
  
  return 0;
}

Submission Info

Submission Time
Task B - 高橋君と禁断の書
User raven38
Language C++ (G++ 4.6.4)
Score 0
Code Size 1720 Byte
Status
Exec Time 153 ms
Memory 1156 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0-sample-01.txt
All 0 / 100 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 944 KB
subtask1-01.txt 29 ms 952 KB
subtask1-02.txt 39 ms 956 KB
subtask1-03.txt 68 ms 1132 KB
subtask1-04.txt 71 ms 1156 KB
subtask1-05.txt 97 ms 1048 KB
subtask1-06.txt 105 ms 984 KB
subtask1-07.txt 73 ms 960 KB
subtask1-08.txt 98 ms 948 KB
subtask1-09.txt 108 ms 952 KB
subtask1-10.txt 146 ms 952 KB
subtask1-11.txt 97 ms 1048 KB
subtask1-12.txt 82 ms 968 KB
subtask1-13.txt 109 ms 960 KB
subtask1-14.txt 120 ms 948 KB
subtask1-15.txt 94 ms 948 KB
subtask1-16.txt 130 ms 984 KB
subtask1-17.txt 92 ms 1048 KB
subtask1-18.txt 92 ms 1056 KB
subtask1-19.txt 99 ms 1064 KB
subtask1-20.txt 121 ms 1044 KB
subtask1-21.txt 140 ms 1112 KB
subtask1-22.txt 144 ms 952 KB
subtask1-23.txt 130 ms 944 KB
subtask1-24.txt 142 ms 948 KB
subtask1-25.txt 141 ms 948 KB
subtask1-26.txt 130 ms 1072 KB
subtask1-27.txt 122 ms 1052 KB
subtask1-28.txt 137 ms 1048 KB
subtask1-29.txt 137 ms 948 KB
subtask1-30.txt 153 ms 980 KB