이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
ll n,S,T,d[2020][2020],mo=1e9+7;
ll depe(ll aa,ll bb)
{
	if(aa==(n+1)&&bb==1)return 1;
	if(aa==(n+1))return 0;
	if(bb<=0)return 0;
	ll ret=d[aa][bb];
	if(ret!=-1)return ret;
	ret=0;
	ll ujg=0;
	if(aa>S)ujg++;
	if(aa>T)ujg++;
	if(aa==S||aa==T)
	{
		ret=(depe(aa+1,bb)+depe(aa+1,bb-1))%mo;
	}	
	else
	{	
		ret=(ret+depe(aa+1,bb+1)*(bb+1-ujg))%mo;
		ret=(ret+depe(aa+1,bb-1)*(bb-1))%mo;
	}
	return d[aa][bb]=ret;
}
int main()
{
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n>>S>>T;
	memset(d,-1,sizeof(d));
	cout<<depe(1,1)<<"\n";
}	
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |