2020-03-15 09:19:27 +08:00
|
|
|
#include <iostream>
|
2020-03-14 17:03:39 +08:00
|
|
|
using namespace std;
|
2020-03-15 09:19:27 +08:00
|
|
|
bool a[51][51] = { 0 };
|
|
|
|
int bi(int x, int y)
|
|
|
|
{
|
|
|
|
a[x][y] = 1;
|
|
|
|
if (a[x - 1][y] == 0){
|
|
|
|
a[x-1][y]=1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
if (a[x][y - 1] == 0){
|
|
|
|
a[x][y-1]=1;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
a[x][y] = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
int m, n, k, ans = 0;
|
|
|
|
cin >> m >> n >> k;
|
|
|
|
for (int i = 1; i <= k; i++) {
|
|
|
|
int x, y;
|
|
|
|
cin >> x >> y;
|
|
|
|
a[x][y] = 1;
|
|
|
|
}
|
|
|
|
for (int i = 0; i <= n; i++) {
|
|
|
|
a[0][i] = 1;
|
|
|
|
}
|
|
|
|
for (int i = 1; i <= m; i++) {
|
|
|
|
a[i][0] = 1;
|
|
|
|
}
|
|
|
|
for (int i = 1; i <= m; i++) {
|
|
|
|
for (int j = 1; j <= n; j++) {
|
|
|
|
if (a[i][j] !=1) {
|
|
|
|
ans += bi(i, j);
|
|
|
|
}/*
|
|
|
|
cout<<ans<<endl;
|
|
|
|
for (int u = 0; u <= m; u++) {
|
|
|
|
for (int e = 0; e <= n; e++) {
|
|
|
|
cout << a[u][e] << " ";
|
|
|
|
}
|
|
|
|
cout << endl;
|
|
|
|
}
|
|
|
|
cout << endl
|
|
|
|
<< endl;*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
cout << ans;
|
2020-03-14 17:03:39 +08:00
|
|
|
}
|