- 奶牛浴场
- 2017-02-09 18:56:50 @
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <iomanip>
using namespace std;
int main() {
//freopen("//xx.in","r",stdin);
//freopen("//xx.out","w",stdout);
int l,w;
cin>>l>>w;
int c;
cin>>c;
int ma=-50000,ma2=-50000;
int h[5001],s[5001];
int x,y,a,b;
for (int i=1;i<=c;i++) cin>>h[i]>>s[i];
for (int i=1;i<=c-1;i++)
{
int cha=h[i+1]-h[i];
if (ma<cha)
{
ma=cha;
x=h[i];
y=h[i+1];
}
}
for (int i=1;i<=c-1;i++)
{
if (h[i]>x&&h[i]<y)
{
int c=h[i]-x;
int d=y-h[i];
if (c>=d) y=h[i];
else x=h[i];
}
}
for (int i=1;i<=c-1;i++)
{
int cha=s[i+1]-s[i];
if (ma2<cha)
{
ma2=cha;
a=s[i];
b=s[i+1];
}
}
for (int i=1;i<=c-1;i++)
{
if (s[i]>a&&s[i]<b)
{
int c=s[i]-x;
int d=y-s[i];
if (c>=d) b=s[i];
else a=h[i];
}
}
cout<<(y-x+1)*(b-a+1)<<endl;
//fclose(stdin);
//fclose(stdout);
//while (1);
return 0;
}