(I2
I110
I4
(dp0
Vsquares.%l
p1
(Vsquares.cpp
p2
S'#include <iostream>\r\n#include <vector>\r\n#include <cmath>\r\nusing namespace std;\r\n\r\nstruct point{\r\n    double x,y;\r\n    void print(){\r\n        if(x!=-100){\r\n            cout<<"("<<x<<","<<y<<")";\r\n        }\r\n    }\r\n};\r\n\r\ndouble dot_product(point a, point b, point c){\r\n    return double(double(a.x-c.x)*double(b.y-c.x)) - double(double(b.x-c.x)*double(a.y-c.x));\r\n}\r\n\r\ndouble len(point a,point b){\r\n    return sqrt((a.x-b.x)*(a.x-b.x) + (a.y-b.y)*(a.y-b.y));\r\n}\r\n\r\nstruct square{\r\n    point center;\r\n    point side[4];\r\n    double S;\r\n    square(point center,point a){\r\n        side[0].x = a.x;\r\n        side[0].y = a.y;\r\n        //cout<<" ("<<(a.x-center.x)<<" : "<<(a.y-center.y)<<") \\n";\r\n        side[2].x = center.x - (a.x-center.x);\r\n        side[2].y = center.y - (a.y-center.y);\r\n        side[1].x = center.x - (a.y-center.y);\r\n        side[1].y = center.y + (a.x-center.x);\r\n        side[3].x = center.x + (a.y-center.y);\r\n        side[3].y = center.y - (a.x-center.x);\r\n        /*cout<<c.x<<" "<<c.y<<endl;\r\n        cout<<d.x<<" "<<d.y<<endl;*/\r\n        double l = len(side[0],side[1]);\r\n        //cout<<l<<endl;\r\n        S = l*l;\r\n    }\r\n};\r\n\r\n\r\ndouble tg(point a, point b){\r\n    if((a.x-b.x)==0) return -1;\r\n    return abs((a.y-b.y))/abs((a.x-b.x));\r\n}\r\n\r\npoint cross(point a,point b, point c, point d){\r\n    \r\n    int del = 1000;\r\n    \r\n    double x = ((b.x-a.x))/double(del);\r\n    double y = ((b.y-a.y))/double(del);\r\n    \r\n    //cout<<x<<" "<<y<<endl;\r\n    \r\n    point e;\r\n    e.x = a.x;\r\n    e.y = a.y;\r\n    \r\n    double tgcd = tg(c,d);\r\n    double tged;\r\n    \r\n    if(tgcd == -1){\r\n        for(int i=0;i<del;i++){\r\n            tged = tg(e,d);\r\n            if(tged==-1 or tged>100000){\r\n                return e;\r\n            }\r\n            e.x+=x;\r\n            e.y+=y;\r\n        }\r\n    }else{\r\n        for(int i=0;i<del;i++){\r\n            tged = tg(e,d);\r\n            //cout<<e.x<<" "<<e.y<<" : ";\r\n            //cout<<tged<<endl;\r\n            if(tged!=-1){\r\n                if(abs(tgcd-tged)<0.0001){\r\n                    return e;\r\n                }\r\n            }\r\n            e.x+=x;\r\n            e.y+=y;\r\n        }\r\n    }\r\n\r\n    e.x = -100;\r\n    e.y = -100;\r\n    e.print();\r\n    return e;\r\n}\r\n\r\nint n;\r\npoint a,b;\r\nvector<square> v;\r\n\r\ndouble arrea = 0;\r\n\r\nint main(){\r\n    cin>>n;\r\n    for(int i=0;i<n;i++){\r\n        cin>>a.x>>a.y>> b.x>>b.y;\r\n        v.push_back(square(a,b));\r\n        arrea += v[i].S;\r\n    }\r\n    for(int i=0;i<n;i++){\r\n        for(int x=0;x<n;x++){\r\n            if(x!=i){\r\n                for(int p=0;p<4;p++){\r\n                    for(int q=0;q<4;q++){\r\n                        if((dot_product(v[i].side[p],v[i].side[(p+1)%4],v[x].side[q])<0\r\n                        and dot_product(v[i].side[p],v[i].side[(p+1)%4],v[x].side[(q+1)%4])>0) \r\n                        or (dot_product(v[i].side[p],v[i].side[(p+1)%4],v[x].side[q])>0 \r\n                        and dot_product(v[i].side[p],v[i].side[(p+1)%4],v[x].side[(q+1)%4])<0)){\r\n                            cout<<p;        v[i].side[p].print();\r\n                            cout<<(p+1)%4;  v[i].side[(p+1)%4].print();\r\n                            cout<<q;        v[x].side[q].print();\r\n                            cout<<(q+1)%4;  v[x].side[(q+1)%4].print();\r\n                            cout<<" ---------- ";\r\n                            cout<<(dot_product(v[i].side[p],v[i].side[(p+1)%4],v[x].side[q]) )<<" "<<( dot_product(v[i].side[p],v[i].side[(p+1)%4],v[x].side[(q+1)%4]));\r\n                            cout<<" -- ";\r\n                            cross(v[i].side[p],v[i].side[(p+1)%4],v[x].side[q],v[x].side[(q+1)%4]).print();\r\n                            cout<<endl;\r\n                        //}\r\n                    }\r\n                }\r\n            }\r\n        }\r\n    }\r\n    cout<<arrea<<endl;\r\n    return 0;\r\n}\r\n/**\r\n2\r\n-35 45 -50 50\r\n-15 35 -40 20\r\n*/'
p3
tp4
stp5
.