#include <iostream>
#include <queue>
using namespace std;
struct coo
{
int x;
int y;
};
const int N = 15;
int n, m, t/*障碍物数*/;
coo b/*开始*/, e/*结束*/, tmp;
coo can[5] = { {0, 0}, {-1, 0}, {0, -1}, {0, 1}, {1, 0} };/*走法*/
int bj[N][N]/*标记*/, nt[N][N];/*障碍物*/
int ans = 0;
void dfs(int ex, int ey)
{
if (ex == e.x && ey == e.y)
{
ans++;
return;
}
for (int i = 1; i <= 4; i++)
{
coo nw;//新点
nw.x = ex + can[i].x;
nw.y = ey + can[i].y;
if (nw.x >= 0 && nw.x <= n && nw.y >= 0 && nw.y <= m && nt[nw.x][nw.y] == 0 && bj[nw.x][nw.y] == 0)
{
bj[ex][ey] = 1;
dfs(nw.x, nw.y);
bj[ex][ey] = 0;
}
}
}
int main()
{
cin >> n >> m >> t;
cin >> b.x >> b.y >> e.x >> e.y;
for (int i = 1; i <= t; i++)
{
cin >> tmp.x >> tmp.y;
nt[tmp.x][tmp.y] = 1;
tmp.x = tmp.y = 0;
}
dfs(b.x, b.y);
cout << ans;
return 0;
}
记录