Submission #243637


Source Code Expand

Copy
#define _USE_MATH_DEFINES

#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

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

int main() {

	cin >> A >> B;

	cin >> N;

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

	for (int i = 0; i < N; i++){
		
		double lb = 0, ub = 90;

		bool flag = false;

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

		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
Task B - 高橋君と禁断の書
User taketake0609
Language C++ (G++ 4.6.4)
Score 0
Code Size 1391 Byte
Status
Exec Time 67 ms
Memory 932 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 24 ms 924 KB
subtask1-01.txt 23 ms 924 KB
subtask1-02.txt 28 ms 816 KB
subtask1-03.txt 40 ms 796 KB
subtask1-04.txt 50 ms 920 KB
subtask1-05.txt 48 ms 792 KB
subtask1-06.txt 59 ms 732 KB
subtask1-07.txt 60 ms 924 KB
subtask1-08.txt 56 ms 928 KB
subtask1-09.txt 56 ms 796 KB
subtask1-10.txt 67 ms 924 KB
subtask1-11.txt 66 ms 924 KB
subtask1-12.txt 65 ms 804 KB
subtask1-13.txt 65 ms 932 KB
subtask1-14.txt 63 ms 796 KB
subtask1-15.txt 65 ms 808 KB
subtask1-16.txt 64 ms 904 KB
subtask1-17.txt 66 ms 924 KB
subtask1-18.txt 64 ms 928 KB
subtask1-19.txt 66 ms 928 KB
subtask1-20.txt 63 ms 796 KB
subtask1-21.txt 63 ms 924 KB
subtask1-22.txt 66 ms 924 KB
subtask1-23.txt 65 ms 800 KB
subtask1-24.txt 65 ms 928 KB
subtask1-25.txt 62 ms 796 KB
subtask1-26.txt 62 ms 928 KB
subtask1-27.txt 65 ms 928 KB
subtask1-28.txt 65 ms 920 KB
subtask1-29.txt 63 ms 808 KB
subtask1-30.txt 60 ms 796 KB