(I2
I142
I4
(dp0
Vsquares.%l
p1
(Vsquares.cpp
p2
S'#include<iostream>\n#include<queue>\nusing namespace std;\nstruct point\n{\n    int x,y;\n    point(){};\n    point(int a,int b)\n    {\n        x=a;\n        y=b;\n    }\n};\nstruct square\n{\n    point v[4],cent;\n    square(){};\n    square(int a,int b,int c,int d)\n    {\n        cent.x=a;\n        cent.y=b;\n        v[0].x=c;\n        v[0].y=d;\n        v[2].x=2*a-c;\n        v[2].y=2*b-d;\n        v[1].x=a+b-d;\n        v[1].y=b+c-a;\n        v[3].x=2*a-v[1].x;\n        v[3].y=2*b-v[1].y;\n    }\n}squares[11];\nbool zero;\nbool orient(point a,point b,point c)\n{\n    zero=false;\n    b.x-=a.x;\n    b.y-=a.y;\n    c.x-=a.x;\n    c.y-=a.y;\n    int sum=b.x*c.y-c.x*b.y;\n    if(sum==0)\n    {\n        zero=true;\n    }\n    return sum>=0;\n}\nbool online(point a,int ind)\n{\n    for(int i=0;i<4;i++)\n    {\n        bool tek=orient(squares[ind].v[i],a,squares[ind].v[(i+1)%4]);\n        point x=squares[ind].v[i];\n        point y=squares[ind].v[(i+1)%4];\n        if(zero&&min(x.x,y.x)<=a.x&&a.x<=max(x.x,y.x)&&min(x.y,y.y)<=a.y&&a.y<=max(x.y,y.y))\n        {\n            return true;\n        }\n    }\n}\nbool inside(point a,int ind)\n{\n    bool init=orient(squares[ind].v[3],a,squares[ind].v[0]);\n    if(zero)\n    {\n        return false;\n    }\n    for(int i=0;i<3;i++)\n    {\n        bool tek=orient(squares[ind].v[i],a,squares[ind].v[i+1]);\n        if(zero||(init!=tek))\n        {\n            return false;\n        }\n    }\n    return true;\n}\nbool touch[11][11];\nbool used[11][11];\nint main(){\n    cin.tie(NULL);\n    ios::sync_with_stdio(false);\n    int n,a,b,c,d;\n    cin>>n;\n    for(int i=0;i<n;i++)\n    {\n        cin>>a>>b>>c>>d;\n        squares[i]=square(a,b,c,d);\n    }\n    point tek;\n    int minus=1;\n    int inl=0,onl=0;\n    bool nin=false;\n    for(tek.x=-110;tek.x<=110;tek.x++)\n    {\n        for(tek.y=-110;tek.y<=110;tek.y++)\n        {\n            for(int i=0;i<n;i++)\n            {\n                for(int j=0;j<n;j++)\n                {\n                    if(i!=j&&online(tek,i)&&online(tek,j))\n                    {\n                        if(used[i][j])\n                        {\n                            if(touch[i][j]==true)\n                            {\n                                onl++;\n                                continue;\n                            }\n                        }\n                        touch[i][j]=true;\n                        for(int p=0;p<4;p++)\n                        {\n                            if(inside(squares[i].v[p],j))\n                            {\n                                touch[i][j]=false;\n                                break;\n                            }\n                            if(inside(squares[j].v[p],i))\n                            {\n                                touch[i][j]=false;\n                                break;\n                            }\n                        }\n                        touch[j][i]=touch[i][j];\n                        if(touch[i][j])\n                        {\n                            onl++;\n                            minus++;\n                        }\n                        used[i][j]=true;\n                        used[j][i]=true;\n                    }\n                }\n            }\n        }\n    }\n    onl/=2;\n    for(tek.x=-200;tek.x<=200;tek.x++)\n    {\n        for(tek.y=-200;tek.y<=200;tek.y++)\n        {\n            nin=false;\n            for(int i=0;i<n;i++)\n            {\n                if(inside(tek,i))\n                {\n                    inl++;\n                    nin=true;\n                    break;\n                }\n            }\n            if(!nin)\n            {\n                point last,pom;\n                bool once=false;\n                for(int i=0;i<n;i++)\n                {\n                    if(online(tek,i))\n                    {\n                        onl++;\n                        break;\n                    }\n                }\n            }\n            }\n        }\n    cout<<onl/2+inl-minus<<"\\n";\n    return 0;\n}\n'
p3
tp4
stp5
.