1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <iostream>
#include <algorithm>
#include <vector>
#define LL long long

using namespace std;
#define PRIME 982451653

int main()
{
    int i, j, n, x1, x2, y1, y2, x, y, X, Y, cx, cy, c;
    LL result = 0, v;
    cin >> n >> X >> Y;
    std::vector<LL> xaxis(X, 0), yaxis(Y, 0);

    for (j=0; j<n; j++) {
        cin >> x1 >> y1 >> x2 >> y2;
        if (x1>x2) std::swap(x1, x2);
        if (y1>y2) std::swap(y1, y2);
        for (i=0; i < X; i++) {
            xaxis[i] *= 2;
            if (x1 <= i && i < x2) xaxis[i] += 1;
            xaxis[i] %= PRIME;
        }
        for (i=0; i < Y; i++) {
            yaxis[i] *= 2;
            if (y1 <= i && i < y2) yaxis[i] += 1;
            yaxis[i] %= PRIME;
        }
    }
    std::sort(xaxis.begin(), xaxis.end());
    std::sort(yaxis.begin(), yaxis.end());
    x = 0;
    y = 0;
    c = 0;
    v = xaxis[0];
    cx = 1;
    for (i=0; i < X; i++) {
        if (v == xaxis[i]) {
            c += 1;
        } else {
            if (c > cx) cx = c;
            v = xaxis[i];
            c = 1;
        }
    }
    if (c > cx) cx = c;
    c = 0;
    v = xaxis[0];
    cy = 1;
    for (i=0; i < Y; i++) {
        if (v == yaxis[i]) {
            c += 1;
        } else {
            if (c > cy) cy = c;
            v = yaxis[i];
            c = 1;
        }
    }
    if (c > cy) cy = c;
    result = cx * cy;

    cout << result << endl;
    return 0;
}