Submission #241786


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;

#define INF 1000000000
#define EPS 1e-10

#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++){

		bool flag1 = true;
		bool flag2 = true;

		double ub, lb;
		ub = max((double)C[i], (double)D[i]);
		lb = 0;

		while (ub - lb > EPS){
			double mid = (ub + lb) / 2;
			double c = (double)C[i] - mid;
			double d = (double)D[i] - mid;
			if (c*c + d * d >= B*B)
				lb = mid;
			else
				ub = mid;
		}

		if (lb * lb * 2 < A*A && lb * lb < B*B){
			cout << "NO" << endl;
		}

		else
			cout << "YES" << endl;


	}

	return 0;
}

Submission Info

Submission Time
Task B - 高橋君と禁断の書
User taketake0609
Language C++ (G++ 4.6.4)
Score 0
Code Size 1241 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 26 ms 800 KB
subtask1-01.txt 25 ms 800 KB
subtask1-02.txt 27 ms 924 KB
subtask1-03.txt 35 ms 804 KB
subtask1-04.txt 37 ms 928 KB
subtask1-05.txt 38 ms 920 KB
subtask1-06.txt 44 ms 784 KB
subtask1-07.txt 43 ms 928 KB
subtask1-08.txt 44 ms 804 KB
subtask1-09.txt 44 ms 800 KB
subtask1-10.txt 48 ms 732 KB
subtask1-11.txt 49 ms 932 KB
subtask1-12.txt 47 ms 800 KB
subtask1-13.txt 48 ms 920 KB
subtask1-14.txt 46 ms 928 KB
subtask1-15.txt 49 ms 800 KB
subtask1-16.txt 47 ms 928 KB
subtask1-17.txt 48 ms 924 KB
subtask1-18.txt 52 ms 796 KB
subtask1-19.txt 48 ms 800 KB
subtask1-20.txt 50 ms 924 KB
subtask1-21.txt 55 ms 764 KB
subtask1-22.txt 51 ms 928 KB
subtask1-23.txt 48 ms 808 KB
subtask1-24.txt 48 ms 800 KB
subtask1-25.txt 49 ms 792 KB
subtask1-26.txt 55 ms 800 KB
subtask1-27.txt 53 ms 800 KB
subtask1-28.txt 67 ms 736 KB
subtask1-29.txt 49 ms 800 KB
subtask1-30.txt 45 ms 800 KB