이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
long long n,m,dp[301][301];
bool vis[301][301];
const long long mod=1e9+7;
long long f(long long i,long long j)
{
    if(j==0 || i==0)
    {
        return 1;
    }
    if(i<0 || j<0)
    {
        return 0;
    }
    if(vis[i][j])
    {
        return dp[i][j];
    }
    vis[i][j]=1;
    dp[i][j]=((((f(i-1,j)+4*j*f(i-1,j-1))%mod+f(i-1,j-2)*j*(j-1)/2)%mod)+f(i-2,j-1)*j*(i-1))%mod;
    return dp[i][j];
}
int main()
{
    cin>>n>>m;
    cout<<f(n,m)-1;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |