显示代码纯文本
#include<bits/stdc++.h>
using namespace std;
long long n,m,x,y,a1[200005],a2[200005],s,M=998244353;
long long f(long long a,long long b){
return a1[a+b-1]*a2[b-1]%M*a2[a]%M;
}
int main(){
freopen("noi_online2020_city.in","r",stdin);
freopen("noi_online2020_city.out","w",stdout);
cin>>m>>n>>x>>y;
a1[0]=a2[0]=a1[1]=a2[1]=1;
for(int i=2;i<=n*2;i++) a1[i]=a1[i-1]*i%M;
for(int i=2;i<=n*2;i++) a2[i]=(M-M/i)*a2[M%i]%M;
for(int i=2;i<=n*2;i++) a2[i]*=a2[i-1],a2[i]%=M;
if(x<=n)
if(y<=n){for(int i=1;i<=m;i++) s+=f(x-1,i)*f(n-y,m-i+1)%M,s%=M;s*=f(n,m);}
else for(int i=1;i<=m;i++) s+=f(x-1,i)*f(n-x,m-i+1)%M*f(y-n-1,m-i+1)%M*f(2*n-y,i)%M,s%=M;
else{for(int i=1;i<=m;i++) s+=f(x-n-1,m-i+1)*f(2*n-y,i)%M,s%=M;s*=f(n,m);}
cout<<s;
return 0;
}