// #pragma GCC target("avx2") // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using pii = pair; using pll = pair; using pli = pair; #define TEST cerr << "TEST" << endl #define AMARI 998244353 // #define AMARI 1000000007 #define TIME_LIMIT 1980000 #define el '\n' #define El '\n' //三角形の外心の中心を返す pair ococo_gaisetuen_tyuusin(int x1,int y1,int x2,int y2,int x3,int y3){ int a = x1,b = y1,c = x2,d = y2,e = x3,f = y3; int bunsiy = (e - a) * (a * a + b * b - c * c - d * d) - (c - a) * (a * a + b * b - e * e - f * f); int bunboy = 2 * (e - a) * (b - d) - 2 * (c - a) * (b - f); if(bunboy == 0){ //この時、一直線に並んでいる if((x1 > x2) == (x2 > x3)){ return pair((x1 + x3) / 2,(y1 + y3) / 2); } if((x1 > x3) == (x3 > x2)){ return pair((x1 + x2) / 2,(y1 + y2) / 2); } return pair((x2 + x3) / 2,(y2 + y3) / 2); } int bunsix,bunbox; if(a != c){ bunsix = 2 * (b - d) * (bunsiy / bunboy) - a * a - b * b + c * c + d * d; bunbox = 2 * (c - a); } else{ bunsix = 2 * (b - f) * (bunsiy / bunboy) - a * a - b * b + e * e + f * f; bunbox = 2 * (e - a); } return pair(bunsix / bunbox,bunsiy / bunboy); } //2点の中心を直径とする円の中心 pair tyokkei(int x1,int y1,int x2,int y2){ pair ans; ans.first = (x1 + x2) / 2; ans.second = (y1 + y2) / 2; return ans; } #define MULTI_TEST_CASE false void solve(void) { //問題を見たらまず「この問題設定から言えること」をいっぱい言ってみる //一個解答に繋がりそうな解法が見えても、実装や細かい考察に時間がかかりそうなら別の方針やを考えてみる //特に添え字周りはそのままやると面倒&言い換えが有効なことが多いので書き始める前にじっくり考える int q; cin >> q; int xa,ya,xb,yb,xc,yc; cin >> xa >> ya >> xb >> yb >> xc >> yc; vector kouho = {ococo_gaisetuen_tyuusin(xa,ya,xb,yb,xc,yc),tyokkei(xa,ya,xb,yb),tyokkei(xb,yb,xc,yc),tyokkei(xc,yc,xa,ya)}; int cx,cy; int r2 = INT_MAX; for(int dx = -1; dx <= 1; dx++){ for(int dy = -1; dy <= 1; dy++){ for(int i = 0; i < 4; i++){ int x,y; x = kouho[i].first + dx; y = kouho[i].second + dy; int val = max({(x - xa) * (x - xa) + (y - ya) * (y - ya),(x - xb) * (x - xb) + (y - yb) * (y - yb),(x - xc) * (x - xc) + (y - yc) * (y - yc)}); if(val < r2){ cx = x; cy = y; r2 = val; } } } } while(q--){ int x,y; cin >> x >> y; if((cx - x) * (cx - x) + (cy - y) * (cy - y) > r2){ cout << "No" << el; continue; } cout << "Yes" << el; } return; } void calc(void) { return; } signed main(void) { cin.tie(nullptr); ios::sync_with_stdio(false); calc(); int t = 1; if(MULTI_TEST_CASE) cin >> t; while(t--) { solve(); } return 0; }