#include #include #include #include using namespace std; #include #include #include using Int=long long; int sign(Int a){return a>0?1:a<0?-1:0;} Int sqr(Int a){return a*a;} struct Rational{ Int a,b; Rational(Int a_=0):a(a_),b(1){} Rational(Int a_,Int b_){ Int g=a_,h=b_; while(h){ Int t=g%h; g=h; h=t; } a=a_/g; b=b_/g; if(b<0)a=-a,b=-b; } bool operator<(const Rational&r)const{return a*r.b>(istream&is,Point&p){return is>>p.x>>p.y;} ostream&operator<<(ostream&os,const Point&p){return os<; //function list begin Point vec(const Line&); Int norm(const Point&); Int norm(const Line&); int argtype(const Point&);//(-pi,0]->-1,(0,pi]->1,(0,0)->0 bool argless(const Point&,const Point&);//sorting points with arg Int dot(const Point&,const Point&); Int cross(const Point&,const Point&); enum{ONLINE_FRONT=-2,CLOCKWISE=-1,ON_SEGMENT=0,COUNTER_CLOCKWISE=1,ONLINE_BACK=2}; int ccw(const Point&,const Point&); int ccw(const Point&,const Point&,const Point&); int ccw(const Line&,const Point&); bool orthogonal(const Point&,const Point&); bool orthogonal(const Line&,const Line&); bool parallel(const Point&,const Point&); bool parallel(const Line&,const Line&); bool intersect(const Line&,const Point&); bool intersect(const Line&,const Line&); bool intersect(const Segment&,const Point&); bool intersect(const Segment&,const Segment&); bool intersect(const Line&,const Segment&); bool intersect(const Segment&,const Line&); bool intersect(const Circle&,const Point&); int intersect(const Circle&,const Line&);//overflow, count contacts int intersect(const Circle&,const Segment&);//overflow, count contacts bool intersect(const Circle&,const Circle&); int count_tangent(const Circle&,const Circle&);//count common tangents Int distance2(const Point&,const Point&); Rational distance2(const Line&,const Point&); Rational distance2(const Line&,const Line&); Rational distance2(const Segment&,const Point&); Rational distance2(const Segment&,const Segment&); Rational distance2(const Line&,const Segment&); Rational distance2(const Segment&,const Line&); bool is_convex(const Polygon&); Polygon convex_hull(Polygon,bool=false); enum{OUT,ON,IN}; int contain(const Polygon&,const Point&); int contain(const Circle&,const Point&); int contain(const Circle&,const Segment&); int convex_contain(const Polygon&,const Point&);//O(log |P|) Int diameter2(Polygon P); //function list end Point vec(const Line&s){return s.p2-s.p1;} Int norm(const Point&p){return p.x*p.x+p.y*p.y;} Int norm(const Line&s){return norm(vec(s));} int argtype(const Point&a){return a.y<0?-1:a.y>0?1:a.x<0?1:a.x>0?-1:0;} bool argless(const Point&a,const Point&b) { int at=argtype(a),bt=argtype(b); return at!=bt?at0; } Int dot(const Point&a,const Point&b){return a.x*b.x+a.y*b.y;} Int cross(const Point&a,const Point&b){return a.x*b.y-a.y*b.x;} int ccw(const Point&a,const Point&b) { Int crs=cross(a,b); return crs>0?COUNTER_CLOCKWISE :crs<0?CLOCKWISE :dot(a,b)<0?ONLINE_BACK :norm(a)>N>>M; for(int i=0;i<2*N;i++)cin>>P[i]; for(int i=0;i>a>>b>>c>>d; a=(a-1)*2+b-1; c=(c-1)*2+d-1; cout<