# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
59590 | theknife2001 | Tents (JOI18_tents) | C++17 | 1047 ms | 71688 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N=3005;
long long dp[N][N];
int n,m;
long long mod=1e9+7;
long long bt(int i, int j)
{
if(i==n)
{
if(j==m)
return 0;
return 1;
}
if(dp[i][j]!=-1)
return dp[i][j];
long long x=bt(i+1,j);
x%=mod;
if(j)
x+=bt(i+1,j-1)*4*j;
x%=mod;
if(j&&i+2<=n)
x+=bt(i+2,j-1)*j*(n-i-1);
x%=mod;
if(j>1)
x+=((bt(i+1,j-2)*j*(j-1))/2)%mod;
x%=mod;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |