結果

問題 No.2602 Real Collider
ユーザー akiaa11akiaa11
提出日時 2024-01-25 18:38:02
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 8,460 bytes
コンパイル時間 4,861 ms
コンパイル使用メモリ 266,136 KB
実行使用メモリ 9,704 KB
最終ジャッジ日時 2024-01-25 18:38:25
合計ジャッジ時間 22,743 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 3 ms
6,676 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 2 ms
6,676 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 154 ms
6,676 KB
testcase_13 AC 74 ms
6,676 KB
testcase_14 AC 165 ms
6,676 KB
testcase_15 AC 88 ms
6,676 KB
testcase_16 AC 140 ms
6,676 KB
testcase_17 AC 152 ms
6,676 KB
testcase_18 AC 107 ms
6,676 KB
testcase_19 AC 132 ms
6,676 KB
testcase_20 WA -
testcase_21 AC 103 ms
6,676 KB
testcase_22 AC 128 ms
6,676 KB
testcase_23 AC 84 ms
6,676 KB
testcase_24 AC 119 ms
6,676 KB
testcase_25 AC 124 ms
6,676 KB
testcase_26 AC 90 ms
6,676 KB
testcase_27 AC 142 ms
6,676 KB
testcase_28 AC 154 ms
6,676 KB
testcase_29 AC 124 ms
6,676 KB
testcase_30 AC 135 ms
6,676 KB
testcase_31 AC 141 ms
6,676 KB
testcase_32 AC 117 ms
6,676 KB
testcase_33 AC 137 ms
6,676 KB
testcase_34 AC 141 ms
6,676 KB
testcase_35 AC 88 ms
6,676 KB
testcase_36 AC 86 ms
6,676 KB
testcase_37 AC 151 ms
6,676 KB
testcase_38 AC 158 ms
6,676 KB
testcase_39 AC 150 ms
6,676 KB
testcase_40 AC 73 ms
6,676 KB
testcase_41 AC 173 ms
6,784 KB
testcase_42 AC 133 ms
6,676 KB
testcase_43 AC 136 ms
6,676 KB
testcase_44 AC 173 ms
6,784 KB
testcase_45 AC 108 ms
6,676 KB
testcase_46 AC 105 ms
6,676 KB
testcase_47 WA -
testcase_48 AC 117 ms
6,676 KB
testcase_49 AC 100 ms
6,676 KB
testcase_50 AC 77 ms
6,676 KB
testcase_51 AC 82 ms
6,676 KB
testcase_52 AC 58 ms
6,676 KB
testcase_53 AC 141 ms
6,676 KB
testcase_54 AC 110 ms
6,676 KB
testcase_55 AC 125 ms
6,676 KB
testcase_56 AC 120 ms
6,676 KB
testcase_57 AC 114 ms
6,676 KB
testcase_58 AC 44 ms
6,676 KB
testcase_59 AC 135 ms
6,676 KB
testcase_60 AC 123 ms
6,676 KB
testcase_61 AC 93 ms
6,676 KB
testcase_62 AC 151 ms
6,676 KB
testcase_63 AC 165 ms
6,676 KB
testcase_64 AC 189 ms
7,020 KB
testcase_65 AC 96 ms
6,676 KB
testcase_66 AC 154 ms
6,676 KB
testcase_67 AC 71 ms
6,676 KB
testcase_68 AC 83 ms
6,676 KB
testcase_69 AC 59 ms
6,676 KB
testcase_70 AC 71 ms
6,676 KB
testcase_71 AC 91 ms
6,676 KB
testcase_72 AC 139 ms
6,676 KB
testcase_73 AC 112 ms
6,676 KB
testcase_74 AC 141 ms
6,676 KB
testcase_75 AC 152 ms
6,676 KB
testcase_76 AC 129 ms
6,676 KB
testcase_77 AC 135 ms
6,676 KB
testcase_78 AC 169 ms
6,784 KB
testcase_79 AC 146 ms
6,676 KB
testcase_80 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define SELECTER(_1,_2,_3,SELECT,...) SELECT
#define rep1(i,n) for(int i=0;i<(int)n;++i)
#define rep2(i,a,n) for(int i=(int)a;i<(int)n;++i)
#define rep(...) SELECTER(__VA_ARGS__,rep2,rep1)(__VA_ARGS__)
#define RSELECTER(_1, _2, _3, RSELECT, ...) RSELECT
#define rrep1(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define rrep2(i,a,n) for(int i=(int)(n)-1;i>=(int)a;--i)
#define rrep(...) RSELECTER(__VA_ARGS__, rrep2, rrep1)(__VA_ARGS__)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fi first
#define se second
#define PrintR LogOutput
#ifdef _DEBUG
#define Log(...) LogOutput(__VA_ARGS__)
#else
#define Log(...)
#endif
using namespace std;
using namespace atcoder;
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
using pdd=pair<long double,long double>;
using tp=tuple<int,int,int>;
using tpll=tuple<ll,ll,ll>;
using veci=vector<int>;
using vecpii=vector<pair<int,int>>;
using vecll=vector<long long>;
using vecpll=vector<pair<long long,long long>>;
using vecpdd=vector<pair<long double,long double>>;
using vecs=vector<string>;
using vecb=vector<bool>;
using vecd=vector<long double>;
using vectp=vector<tp>;
using vectpll=vector<tpll>;
using mint=modint998244353;
using mint10=modint1000000007;
template<typename T, typename S>
istream& operator>>(istream& in, pair<T, S>& a){return in >> a.first >> a.second;}
template<typename T, typename S>
ostream& operator<<(ostream& out, const pair<T, S>& a){return out << a.first << ' ' << a.second;}
ostream& operator<<(ostream& out, const mint& a){return out << a.val();}
ostream& operator<<(ostream& out, const mint10& a){return out << a.val();}
ostream& operator<<(ostream& out, const modint& a){return out << a.val();}
template<typename T>
ostream& operator<<(ostream& out, const vector<T>& d){for(int i = 0 ; i < d.size() ; ++i) out << d[i] << (i == d.size() - 1 ? "" : " "); return out;}
template<typename T, typename S>
pair<T, S> operator+(const pair<T, S>& a, const pair<T, S>& b){return {a.fi + b.fi, a.se + b.se};}
template<typename T, typename S>
pair<T, S> operator-(const pair<T, S>& a, const pair<T, S>& b){return {a.fi - b.fi, a.se - b.se};}
template<class T> inline bool chmax(T& a,T b){if(a<b) {a=b;return true;} return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b) {a=b;return true;} return false;}
bool Judge(int i, int j, int h, int w){return i < 0 || j < 0 || i >= h || j >= w;}
bool PrintA(int i){cout<<(i ? "Yes" : "No")<<endl;return i;}

constexpr ll INF=numeric_limits<ll>::max() >> 2;
constexpr int inf=numeric_limits<int>::max() >> 1;
constexpr ll MOD=998244353;
const int vi[] = {0, 1, 0, -1}, vj[] = {1, 0, -1, 0};

template<typename... Args>
void LogOutput(Args&&... args){
	stringstream ss;
	((ss << args << ' '), ...);
	cout << ss.str().substr(0, ss.str().length() - 1) << endl;
}
template<typename T>
void LogOutput(vector<vector<T>>& data){for(auto d : data) LogOutput(d);}

const double EPS = 1e-8;

template<typename T>
struct Point{
	T x, y;
	Point(){}
	Point(T a, T b) : x(a), y(b){}
	Point& operator=(const Point& a){x = a.x; y = a.y; return *this;}
	Point operator+(const Point& a) const {return {x + a.x, y + a.y};}
	Point& operator+=(const Point& a){x += a.x; y += a.y; return *this;}
	Point operator-(const Point& a) const {return {x - a.x, y - a.y};}
	Point& operator-=(const Point& a){x -= a.x; y -= a.y; return *this;}
	template<typename S>
	Point operator/(const S& a) const {return {x / a, y / a};}
	template<typename S>
	Point operator*(const S& a) const {return {x * a, y * a};}
};


template<typename T>
int sgn(T a){return (a < -EPS ? -1 : (a > EPS ? 1 : 0));}

template<typename T>
std::istream& operator>>(std::istream& in, Point<T>& a){return in >> a.x >> a.y;}
template<typename T>
std::ostream& operator<<(std::ostream& out, const Point<T>& a){return out << a.x << ' ' << a.y;}


template<typename T>
bool operator<(const Point<T>& a, const Point<T>& b){
	if(sgn(a.x - b.x)) return sgn(a.x - b.x) < 0;
	return sgn(a.y - b.y) < 0;
}
template<typename T>
bool operator<=(const Point<T>& a, const Point<T>& b){
	if(sgn(a.x - b.x)) return sgn(a.x - b.x) <= 0;
	return sgn(a.y - b.y) <= 0;
}

template<typename T>
long double distance(const Point<T>& a, const Point<T>& b){
	return sqrtl((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}


template<typename T>
bool eq(const Point<T>& a, const Point<T>& b){return distance(a, b) < EPS;}

template<typename T>
struct Line{
	Point<T> a, b;
	Line(Point<T> a2, Point<T> b2) : a(a2), b(b2){}
	Point<T> large() const{return max(a, b);}
	Point<T> small() const{return min(a, b);}
};
long double to_radian(int theta){return (theta + 360) % 360 * M_PI / 180.0;}
template<typename T>
T cross(const Point<T>& a, const Point<T>& b){return a.x * b.y - a.y * b.x;}
template<typename T>
T dot(const Point<T>& a, const Point<T>& b){return a.x * b.x + a.y * b.y;}
template<typename T>
Point<T> rot(const Point<T>& a, long double rad){return {cos(rad) * a.x - sin(rad) * a.y, sin(rad) * a.x + cos(rad) * a.y};}
template<typename T>
Point<T> rot(const Point<T>& a, int theta){return rot(a, to_radian(theta));}
template<typename T>
Line<T> perpendiculer_bisecor(const Point<T>& a, const Point<T>& b){
	return {(a + b) / 2, (a + b) / 2 + rot(a - b, 90)};
}

template<typename T>
int ccw(const Point<T>& a, const Point<T>& b, const Point<T>& c){
	if(cross(b - a, c - a) > (T)EPS) return 1;
	if(cross(b - a, c - a) < (T)-EPS) return -1;
	return 0;
}


template<typename T>
bool intersect(const Line<T>& s, const Line<T>& t){
	
	if(ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) == 0)
		return (s.small() <= t.large() && t.large() <= s.large()) ||
			(t.small() <= s.large() && s.large() <= t.large());

	return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 &&
		ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

template<typename T>
Point<T> intersection(const Line<T>& s, const Line<T>& t){
	T d = cross(t.a - s.a, t.b - t.a);
	T d2 = cross(s.b - s.a, t.b - t.a);
	if(abs(d) < (T)EPS && abs(d2) < (T)EPS) return s.a;
	return s.a + (s.b - s.a) * d / d2;
}

template<typename T>
Point<T> circlecenter(const Point<T>& a, const Point<T>& b, const Point<T>& c){
	Line<T> l = perpendiculer_bisecor(a, b);
	Line<T> l2 = perpendiculer_bisecor(a, c);
	return intersection(l, l2);
}

template<typename T>
bool Isupper(const Point<T>& a){
	return a.y > 0 || (a.y == 0 && a.x > 0);
}
template<typename T>
bool argument_compare(const Point<T>& a, const Point<T>& b){
	return Isupper(a) == Isupper(b) ? cross(a, b) > 0 : Isupper(a) > Isupper(b);
}

template<typename T>
long double Distance_Point_to_Line(const Point<T>& p, const Line<T>& l){
	if(dot(p - l.a, l.b - l.a) < 0)
		return distance(p, l.a);
	if(dot(p - l.b, l.a - l.b) < 0)
		return distance(p, l.b);
	return abs(cross(p - l.a, l.b - l.a) / distance(l.a, l.b));
}

template<typename T>
struct Circle{
	Point<T> ct;
	T r;
	Circle(Point<T> a, T b) : ct(a), r(b){}
};


template<typename T>
std::vector<Point<T>> Circle_intersections(const Circle<T>& a, const Circle<T>& b){
	long double d = distance(a.ct, b.ct);
	if(d < EPS) return {};
	if(d > a.r + b.r + EPS) return {};
	if(d < abs(a.r - b.r) - EPS) return {};
	long double rcos = (a.r * a.r + d * d - b.r * b.r) / (2 * d);
	long double rsin = sqrtl(a.r * a.r - rcos * rcos);
	Point<T> e = (b.ct - a.ct) / d;
	Point<T> e2 = rot(e, (long double)M_PI / 2);
	Point<T> e3 = rot(e, (long double)-M_PI / 2);
	Point<T> p = a.ct + e * rcos + e2 * rsin;
	Point<T> p2 = a.ct + e * rcos + e3 * rsin;
	std::vector<Point<T>> res(1, p);
	if(eq(p, p2) == 0) res.push_back(p2);
	return res;
}

int main(){
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int q;cin>>q;
	vector<Point<ld>> a(3);
	rep(i, 3) cin>>a[i];
	vector<Point<ld>> b(q);
	rep(i, q) cin>>b[i];
	ld _min = INF;
	Point<ld> c{0, 0};
	rep(i, 3) rep(j, i + 1, 3){
		int k = 0;
		while(k == i || k == j) k++;
		if(sgn(distance(a[i], a[j]) / 2 - distance(a[k], (a[i] + a[j]) / 2)) >= 0){
			ld d = distance(a[i], a[j]) / 2;
			if(sgn(d - _min) < 0){
				_min = d;
				c = (a[i] + a[j]) / 2;
			}
		}
	}
	if(ccw(a[0], a[1], a[2]) != 0){
		Point<ld> p = circlecenter(a[0], a[1], a[2]);
		ld r = distance(p, a[0]);
		if(sgn(r - _min) < 0){
			_min = r;
			c = p;
		}
	}
	rep(i, q){
		ld r = (c.x - b[i].x) * (c.x - b[i].x) + (c.y - b[i].y) * (c.y - b[i].y);
		if(sgn(r - _min * _min) <= 0){
			cout<<"Yes"<<endl;
		}else cout<<"No"<<endl;
	}
}

0