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
Task B - 高橋君と禁断の書
User raven38
Language C++ (G++ 4.6.4)
Score 0
Code Size 1414 Byte
Status
Exec Time 58 ms
Memory 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
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 24 ms 800 KB
subtask1-01.txt 23 ms 920 KB
subtask1-02.txt 25 ms 916 KB
subtask1-03.txt 32 ms 796 KB
subtask1-04.txt 31 ms 800 KB
subtask1-05.txt 39 ms 672 KB
subtask1-06.txt 39 ms 748 KB
subtask1-07.txt 27 ms 736 KB
subtask1-08.txt 36 ms 920 KB
subtask1-09.txt 41 ms 672 KB
subtask1-10.txt 55 ms 924 KB
subtask1-11.txt 33 ms 756 KB
subtask1-12.txt 29 ms 676 KB
subtask1-13.txt 34 ms 800 KB
subtask1-14.txt 41 ms 800 KB
subtask1-15.txt 32 ms 804 KB
subtask1-16.txt 51 ms 796 KB
subtask1-17.txt 33 ms 800 KB
subtask1-18.txt 31 ms 800 KB
subtask1-19.txt 33 ms 788 KB
subtask1-20.txt 37 ms 800 KB
subtask1-21.txt 50 ms 788 KB
subtask1-22.txt 57 ms 792 KB
subtask1-23.txt 41 ms 916 KB
subtask1-24.txt 58 ms 796 KB
subtask1-25.txt 58 ms 796 KB
subtask1-26.txt 48 ms 804 KB
subtask1-27.txt 36 ms 800 KB
subtask1-28.txt 58 ms 676 KB
subtask1-29.txt 54 ms 672 KB
subtask1-30.txt 57 ms 672 KB