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
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define f first
#define s second

const int N = 1000005;
int n, i, mx, my, nx, ny, x, y, pre;
ull col;
ll ox, oy;
int ax [N];
int ay [N];
int bx [N];
int by [N];
int tx [N];
int ty [N];
ull cx [N];
ull cy [N];
map <ull,ll> wy, wx;
map <int,int> MY, MX;

ull randul () {
	return 1ull * rand() * rand() * rand();
	}

int main ()
	{
	srand(666);
	
	scanf ("%d%d%d", &n, &mx, &my);
	
	MX[0] = 1;
	MY[0] = 1;
	MX[mx] = 1;
	MY[my] = 1;
	for (i=1; i<=n; i++)
		{
		scanf ("%d%d%d%d", &ax[i], &ay[i], &bx[i], &by[i]);
		MX[ax[i]] = 1;
		MX[bx[i]] = 1;
		MY[ay[i]] = 1;
		MY[by[i]] = 1;
		}
	
	i = -1;
	pre = -1;
	for (pair <int,int> p : MX)
		{
		if (p.f != pre)
			i++;
		MX[p.f] = i;
		pre = p.f;
		tx[i] = p.f;
		}
	nx = i;
	
	i = -1;
	pre = -1;
	for (pair <int,int> p : MY)
		{
		if (p.f != pre)
			i++;
		MY[p.f] = i;
		pre = p.f;
		ty[i] = p.f;
		}
	ny = i;
	
	for (i=1; i<=n; i++)
		{
		ax[i] = MX[ax[i]];
		ay[i] = MY[ay[i]];
		bx[i] = MX[bx[i]];
		by[i] = MY[by[i]];
		
		col = randul();
		cx[0] ^= col;
		cx[ax[i]] ^= col;
		cx[bx[i]] ^= col;
		
		col = randul();
		cy[0] ^= col;
		cy[ay[i]] ^= col;
		cy[by[i]] ^= col;
		}
	
	for (i=1; i<ny; i++)
		cy[i] ^= cy[i-1];
	
	for (i=1; i<nx; i++)
		cx[i] ^= cx[i-1];
	
	for (i=0; i<ny; i++)
		wy[cy[i]] += ty[i+1] - ty[i];
	
	for (i=0; i<nx; i++)
		wx[cx[i]] += tx[i+1] - tx[i];
	
	for (pair <ull,ll> p : wy)
		oy = max(oy, p.s);
	
	for (pair <ull,ll> p : wx)
		ox = max(ox, p.s);
	
	printf ("%lld\n", ox*oy);
	return 0;
	}