• + 0 comments

    include

    using namespace std;

    int main() { int t; cin>>t; double x1,y1,x2,y2,xm,ym,x0,y0; for(int i=0;i

        for(int i=0;i<6;i++)
        {
            cin>>arr[i];
    
        }
    
       x1=arr[0];y1=arr[1];x2=arr[2];y2=arr[3];xm=arr[4];ym=arr[5];
       x0=0;y0=0;
    
       double t=(x0-x1)*(y2-y1)-(x2-x1)*(y0-y1);
       double p=(xm-x1)*(y2-y1)-(x2-x1)*(ym-y1);
    
       if(t<0 && p<0)
       {
           cout<<"YES"<<endl;
       }
       else if(t>0 && p>0)
       {
           cout<<"YES"<<endl;
       }
       else if(t==0 && p>0)
       {
           cout<<"YES"<<endl;
    
       }
       else if(t==0 && p<0)
       {
           cout<<"YES"<<endl;
       }
    
       else if(t==0 && p==0)
       {
           if(xm==0 && abs(ym)<abs(y1) && abs(ym)<abs(y2))
           {
               cout<<"YES"<<endl;
           }
           else if(ym==0 && abs(xm)<abs(x1) && abs(xm)<abs(x2))
           {
               cout<<"YES"<<endl;
           }
           else if  (xm==0 && ym==0)
           {
                cout<<"YES"<<endl;
           }
           else if (ym/xm==(y2-y1)/(x2-x1)){
    
                if(xm<x1 &&xm<x2)
                cout<<"YES"<<endl;
           else
            cout<<"NO"<<endl;
    
           }
       }
       else
       {
           if(xm==0)
           {
               if((x1>=0 && x2<=0)||(x1<=0 && x2>=0))cout<<"NO"<<endl;
               else cout<<"YES"<<endl;
           }
           else if(ym==0)
           {
               if((y1>=0 && y2<=0)||(y1<=0 && y2>=0))cout<<"NO"<<endl;
               else cout<<"YES"<<endl;
    
           }
           else
           {
               double t=(y2-y1)-(x2-x1)*ym/xm;
               double p=x1*(y2-y1)-y1*(x2-x1);
               double x=p/t;
               if((x1>=x && x2<=x)||(x1<=x && x2>=x))cout<<"NO"<<endl;
               else cout<<"YES"<<endl;
    
    
           }
       }
    
    
    
    
    }
    
    
    }