(I2
I148
I4
(dp0
Vsquares.%l
p1
(Vsquares.cpp
p2
S'#include <cstdio>\r\n#include <algorithm>\r\n\r\n#define DIM 800\r\nusing namespace std;\r\n\r\ntemplate <typename TYPE>\r\nTYPE abs (TYPE X) {\r\n    return X > 0 ? X : -X;\r\n}\r\n\r\nstruct str {\r\n    int cornerX, cornerY;\r\n    int centerX, centerY;\r\n} Points[DIM];\r\n\r\nint diffX, diffY, X, Y, N, ok, arrea;\r\nint D[DIM][DIM];\r\n\r\nint main () {\r\n\r\n    freopen ("squares.in" ,"r", stdin );\r\n    freopen ("squares.out","w", stdout);\r\n    \r\n    scanf ("%d", &N); ok = 1;\r\n    for (int i = 1; i <= N; i ++) {\r\n        scanf ("%d %d", &Points[i].centerX, &Points[i].centerY);\r\n        scanf ("%d %d", &Points[i].cornerX, &Points[i].cornerY);\r\n        \r\n        if (abs (Points[i].centerX - Points[i].cornerX) != abs (Points[i].centerY - Points[i].cornerY))\r\n            ok = 0;\r\n    }\r\n    \r\n    if (ok == 1) {\r\n        for (int i = 1; i <= N; i ++) {\r\n            Points[i].centerX += 300;\r\n            Points[i].centerY += 300;\r\n            Points[i].cornerX += 300;\r\n            Points[i].cornerY += 300;\r\n            \r\n            diffX = abs (Points[i].centerX - Points[i].cornerX);\r\n            diffY = abs (Points[i].centerY - Points[i].cornerY);\r\n            X = Points[i].centerX;\r\n            Y = Points[i].centerY;\r\n            \r\n            D[X-diffX][Y-diffY] ++;\r\n            D[X+diffX][Y-diffY] --;\r\n            D[X-diffX][Y+diffY] --;\r\n            D[X+diffX][Y+diffY] ++;\r\n        }\r\n        \r\n        for (int i = 1; i < DIM; i ++)\r\n        for (int j = 1; j < DIM; j ++) {\r\n            D[i][j] = (D[i][j] + D[i][j-1] + D[i-1][j] - D[i-1][j-1]);\r\n            arrea += D[i][j] > 0 ? 1 : 0;\r\n        }\r\n        \r\n        printf ("%d\\n", arrea);\r\n        \r\n    } else {\r\n    }\r\n\r\n    return 0;\r\n}'
p3
tp4
stp5
.