#pragma GCC optimize(2,3,"Ofast")
#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
const int MAXN=1e3+5;
int n,m,sx,sy,ex,ey,flag[MAXN][MAXN],dir[4][2]={{1,-2},{-1,-2},{2,-1},{-2,-1}};
int dfs(int x,int y){
if(!flag[x][y]){
for(int i=0,nx,ny,t;i<4;i++){
nx=x+dir[i][0],ny=y+dir[i][1];
if(nx>=1&&nx<=n&&ny>=1&&ny<=m){
t=dfs(nx,ny);
if(t!=-1145141919810) flag[x][y]+=t;
}
if(flag[x][y]==0) flag[x][y]=-1145141919810;
}
}
return flag[x][y];
}
signed main(){
cin>>n>>m>>sx>>sy>>ex>>ey;
flag[sx][sy]=1;
dfs(sx,sy);
cout<<flag[ex][ey];
return 0;
}
共 2 条回复