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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 #include using namespace std; typedef long long LL; typedef pair PII; typedef pair PLL; typedef vector VI; const int INF = 1000000009; const LL LINF = 1000000000000000009LL; #define FOR(i, b, e) for (int i = b; i <= e; ++i) #define FORD(i, b, e) for (int i = b; i >= e; --i) #define REP(i, n) FOR (i, 0, n - 1) #define REV(i, n) FORD (i, n - 1, 0) #define PB push_back #define PP pop_back #define MP make_pair #define MT make_tuple #define ST first #define ND second #define SZ(c) (int)(c).size() #define ALL(c) (c).begin(), (c).end() #define UNIQ(c) (c).erase(unique(ALL(c)), (c).end()); // #include // #include // using namespace __gnu_pbds; // typedef tree, rb_tree_tag, tree_order_statistics_node_update> ordered_set; /*find_by_order() order_of_key()*/ template ostream &operator<<(ostream &out, const pair &v) { return (out << "(" << v.ST << ", " << v.ND << ")"); } #define DEBUG(s) s #ifdef local_comp #define PRINT(V) cout << "#" << #V << ": " << V << endl; #else #define PRINT(v) #endif const int N = 500005; int tab[N][4]; int n, x, y; struct event { int t, type, id; bool operator<(const event &e) const { return MT(t, type, id) < MT(e.t, e.type, e.id); } }; vector xs[2]; vector vals[2]; const LL X = 31ll; const LL MOD = 109890109890109837ll; LL pows[N]; LL res[2]; map best[2]; void init() { pows[0] = 1; FOR (i, 1, n) pows[i] = (pows[i - 1] * X) % MOD; } int main() { #ifndef local_comp ios::sync_with_stdio(0); cin.tie(0); #endif cin >> n >> x >> y; init(); FOR (i, 1, n) { REP (j, 4) cin >> tab[i][j]; REP (j, 2) { xs[j].PB({min(tab[i][0 + j], tab[i][2 + j]) + 1, 0, i}); xs[j].PB({max(tab[i][0 + j], tab[i][2 + j]) + 1, 1, i}); vals[j].PB(tab[i][0 + j]); vals[j].PB(tab[i][2 + j]); } } vals[0].PB(0); vals[0].PB(x); vals[1].PB(0); vals[1].PB(y); REP (i, 2) { sort(ALL(vals[i])); UNIQ(vals[i]); sort(ALL(xs[i])); } REP (ii, 2) { LL current_hash = 0; int it = 0; FOR (i, 1, SZ(vals[ii]) - 1) { int mx = vals[ii][i]; while (it < SZ(xs[ii]) && xs[ii][it].t <= mx) { if (xs[ii][it].type == 0) current_hash += pows[xs[ii][it].id]; else current_hash = (current_hash - pows[xs[ii][it].id] + MOD) % MOD; it++; } best[ii][current_hash] += (vals[ii][i] - vals[ii][i - 1]); } } REP (i, 2) for (auto it : best[i]) res[i] = max(res[i], it.ND); cout << res[0] * res[1] << "\n"; return 0; }