using System; using System.Collections; using System.Collections.Generic; class TEST{ static void Main(){ Sol mySol =new Sol(); mySol.Solve(); } } class Sol{ public void Solve(){ int cMax=0; int cnt=0; for(int i=0;iMath.Max(b1.X,b2.X))return false; if(Math.Max(a1.X,a2.X)Math.Max(b1.Y,b2.Y))return false; if(Math.Max(a1.Y,a2.Y)0) return false; //on the same line - "not intersect" only if one of the vertices is common, //and the other doesn't belong to the line if(Pair.eqCo(a1,b1) && (a2-a1).L2()+(b2-b1).L2()==(b2-a2).L2())return false; if(Pair.eqCo(a1,b2) && (a2-a1).L2()+(b2-b1).L2()==(b1-a2).L2())return false; if(Pair.eqCo(a2,b1) && (a2-a1).L2()+(b2-b1).L2()==(b2-a1).L2())return false; if(Pair.eqCo(a2,b2) && (a2-a1).L2()+(b2-b1).L2()==(b1-a1).L2())return false; return true; } //common vertices if(Pair.eqCo(a1,b1)||Pair.eqCo(a1,b2)||Pair.eqCo(a2,b1)||Pair.eqCo(a2,b2))return false; double u1 = num1*1.0/den; double u2 = num2*1.0/den; if (u1<0 || u1>1 || u2<0 || u2>1)return false; return true; } struct Pair{ public int X; public int Y; public Pair(int x,int y){ X=x;Y=y; } public static Pair operator-(Pair p,Pair q){ return new Pair(p.X-q.X,p.Y-q.Y); } public static Pair operator*(int r,Pair p){ return new Pair(r*p.X,r*p.Y); } public static Pair operator+(Pair p,Pair q){ return new Pair(p.X+q.X,p.Y+q.Y); } public static int det(Pair p,Pair q){ return (p.X*q.Y-p.Y*q.X); } public static int dot(Pair p,Pair q){ return (p.X*q.X+p.Y*q.Y); } public int L2(){ return X*X+Y*Y; } public double L(){ return Math.Sqrt(X*X+Y*Y); } public static bool eqCo(Pair p,Pair q){ return p.X==q.X&&p.Y==q.Y; } } static double dist(Pair e1,Pair e2,Pair x){ if(Pair.dot(e2-e1,x-e1)<=0){ return (x-e1).L(); } if(Pair.dot(e2-e1,x-e2)>=0){ return (x-e2).L(); } return Math.Abs(-(e2-e1).Y*x.X+(e2-e1).X*x.Y+e1.X*e2.Y-e1.Y*e2.X)/(e2-e1).L(); } // --------------------------------------------------- static double dist2(Pair e1,Pair e2,Pair x1,Pair x2) { //distance from the closest of the endpoints of "other" to "this" return Math.Min(dist(e1,e2,x1), dist(e1,e2,x2)); } Pair[] longEdge(Pair a,Pair b){ return new Pair[]{ b+100*(b-a), a+100*(a-b) }; } static String rs(){return Console.ReadLine();} static int ri(){return int.Parse(Console.ReadLine());} static long rl(){return long.Parse(Console.ReadLine());} static double rd(){return double.Parse(Console.ReadLine());} static String[] rsa(){return Console.ReadLine().Split(' ');} static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));} static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));} static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));} }