#include #include using namespace std; using namespace atcoder; #define rep(i, n) for(int i=0;i<(n);++i) #define rep1(i, n) for(int i=1;i<=(n);i++) #define ll long long using mint = modint998244353; using P = pair; using lb = long double; using T = tuple; #ifdef LOCAL # include # define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else # define dbg(...) (static_cast(0)) #endif template struct Matrix { int h, w; vector> d; Matrix() {} //初期化のときは Matrix<> a(h, w) Matrix(int h, int w, T val=0): h(h), w(w), d(h, vector(w,val)) {} Matrix& unit() { assert(h == w); rep(i,h) d[i][i] = 1; return *this; } const vector& operator[](int i) const { return d[i];} vector& operator[](int i) { return d[i];} Matrix operator*(const Matrix& a) const { assert(w == a.h); Matrix r(h, a.w); rep(i,h)rep(k,w)rep(j,a.w) { r[i][j] += d[i][k]*a[k][j]; } return r; } //Matcix<> newa = a.pow(k)と使う Matrix pow(long long t) const { assert(h == w); if (!t) return Matrix(h,h).unit(); if (t == 1) return *this; Matrix r = pow(t>>1); r = r*r; if (t&1) r = r*(*this); return r; } }; // Vector // https://youtu.be/UWbGRhF3Ozw?t=9564 long double eps = 1e-12; struct V { long double x, y; V(long double x=0, long double y=0): x(x), y(y) {} V& operator+=(const V& v) { x += v.x; y += v.y; return *this;} V operator+(const V& v) const { return V(*this) += v;} V& operator-=(const V& v) { x -= v.x; y -= v.y; return *this;} V operator-(const V& v) const { return V(*this) -= v;} V& operator*=(long double s) { x *= s; y *= s; return *this;} V operator*(long double s) const { return V(*this) *= s;} V& operator/=(long double s) { x /= s; y /= s; return *this;} V operator/(long double s) const { return V(*this) /= s;} long double dot(const V& v) const { return x*v.x + y*v.y;} long double cross(const V& v) const { return x*v.y - v.x*y;} long double norm2() const { return x*x + y*y;} long double norm() const { return sqrt(norm2());} V normalize() const { return *this/norm();} V rotate90() const { return V(y, -x);} int ort() const { // orthant if (abs(x) < eps && abs(y) < eps) return 0; if (y > 0) return x>0 ? 1 : 2; else return x>0 ? 4 : 3; } bool operator<(const V& v) const { int o = ort(), vo = v.ort(); if (o != vo) return o < vo; return cross(v) > 0; } }; istream& operator>>(istream& is, V& v) { is >> v.x >> v.y; return is; } ostream& operator<<(ostream& os, const V& v) { os<<"("<> q; ll x1, y1, x2, y2, x3, y3; cin >> x1 >> y1 >> x2 >> y2 >> x3 >> y3; ll r; if((x2-x1)*(y3-y1) == (x3-x1)*(y2-y1)){ ll Mx = max(x1, max(x2,x3)); ll mx = min(x1, min(x2, x3)); ll My = max(y1,max(y2, y3)); ll my = min(y1,min(y2, y3)); r = (Mx-mx) * (Mx-mx) + (My-my)*(My-my); ll xg = (mx+Mx); ll yg = (my+My); rep(i,q){ ll x, y; cin >> x >> y; x *= 2 ; y *= 2 ; ll R = (xg-x)*(xg-x) + (yg-y) * (yg-y); if(R<=r) { cout << "Yes" << "\n"; } else{ cout << "No" << "\n"; } } } else{ ll det = (x2-x1)*(y3-y1) - (x3-x1)*(y2-y1); Matrix m(2,2); m[1][1] = x2-x1; m[0][1] = -y2+y1; m[0][0] = y3-y1; m[1][0] = -x3+x1; Matrix f(2,1); f[0][0] = x2*x2+y2*y2 - x1*x1-y1*y1; f[1][0] = x3*x3+y3*y3 - x1*x1-y1*y1; dbg(det); Matrix e = m*f; r = (e[0][0]-2*det*x1) * (e[0][0]-2*det*x1) + (e[1][0]-2*det*y1) * (e[1][0] - 2*det*y1); dbg(e[0][0], e[1][0]); dbg(r); rep(i,q){ ll x, y; cin >> x >> y; x *= 2 *det; y *= 2 *det; ll R = (e[0][0]-x)*(e[0][0]-x) + (e[1][0]-y) * (e[1][0]-y); dbg(R); if(R<=r) { cout << "Yes" << "\n"; } else{ cout << "No" << "\n"; } } } return 0; }