#include using namespace std; struct pt{long long x,y;}; double mltpl(pt a, pt b){ //Векторное умножение А*В return (a.x*b.y - b.x*a.y); } pt line(pt a, pt b){ pt c; c.x = b.x - a.x; c.y = b.y - a.y; return c; } bool oneside(pt a, pt b, pt c, pt d){ //Лежат ли точки С и D на одной стороне от AB pt ab, ac, ad; ab = line(a, b); ac = line(a, c); ad = line(a, d); if((mltpl(ac, ab)>0 && mltpl(ad, ab)>0)|| (mltpl(ac, ab)<0 && mltpl(ad, ab)<0)){ return true; } return false; } bool lay(pt a,pt b,pt c){ //Лежат ли 3 точки на 1 прямой if((c.x - a.x)*(b.y - a.y)==(c.y - a.y)*(b.x - a.x)) return true; return false; } bool intersect(int a,int b,int c,int d){ // Пересекаются ли AB и CD если лежат на 1 прямой if (a > b) swap(a, b); if (c > d) swap(c, d); return max(a, c) <= min(b, d); } int main() { pt a,b,c,d; cin >> a.x >> a.y >> b.x >> b.y >> c.x >> c.y >> d.x >> d.y; pt ab, ac, ad, cb, cd; ab = line(a, b); ac = line(a, c); ad = line(a, d); cb = line(c, b); cd = line(c, d); if (oneside(a, b, c, d)){ cout << "No"; return 0; } if (oneside(c, d, a, b)){ cout << "No"; return 0; } if ((lay(a,b,c) && lay(b,c,d)) == false){ cout << "Yes"; return 0; } if (intersect(a.x, b.x, c.x, d.x) && intersect(a.y, b.y, c.y, d.y)){ cout << "Yes"; return 0; } cout << "No"; return 0; }