10703

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>

#define INF 1000000
using namespace std;

void swp(int *p,int *q)
{
	int tmp;
	tmp=*p;
	*p=*q;
	*q=tmp;
}
int main()
{
	int h,w,n;
	int a,b,c,d;
	bool gr[505][505];
	while(cin>>h)
	{
		cin>>w>>n;
		if(h+w+n==0)
		break;
		memset(gr,0,sizeof(gr));
		int cnt=0;
		for(int k=0;k<n;k++)
		{
			cin>>a>>b>>c>>d;
			if(a>c)
			swp(&a,&c);
			if(b>d)
			swp(&b,&d);
			for(int i=a;i<=c;i++)
			{
				for(int j=b;j<=d;j++)
				{
					if(gr[i][j]==0)
					{
						cnt+=1;
						gr[i][j]=1;
					}
				}
			}
		}
		int ans = h*w-cnt;
		if(ans==0)
			cout<<"There is no empty spots.\n";
		else if(ans==1)
			cout<<"There is one empty spot.\n";
		else
			cout<<"There are "<<ans<<" empty spots.\n";
	}
	return 0;
}

 

Leave a Reply

Your email address will not be published. Required fields are marked *