結果
| 問題 |
No.2602 Real Collider
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-01-25 18:38:02 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 8,460 bytes |
| コンパイル時間 | 4,352 ms |
| コンパイル使用メモリ | 255,336 KB |
| 最終ジャッジ日時 | 2025-02-18 22:42:02 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 68 WA * 10 |
ソースコード
#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;
}
}