# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49323 | okaybody10 | Tents (JOI18_tents) | C++11 | 439 ms | 59340 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;
typedef long long ll;
const int MOD = 1e9+7;
ll dp[3005][3005];
ll d(int h,int w)
{
if(h<0 || w<0) return 0;
if(h==0 || w==0) return 1;
if(dp[h][w]) return dp[h][w];
ll ret=0;
ret+=d(h-1,w); ret%=MOD;
ret+=4*w*d(h-1,w-1); ret%=MOD;
ret+=w*(w-1)/2*d(h-1,w-2); ret%=MOD;
ret+=(h-1)*w*d(h-2,w-1); ret%=MOD;
return dp[h][w]=ret%MOD;
}
int main(){
int h,w; scanf("%d %d",&w,&h);
d(h,w);
printf("%lld",(dp[h][w]+MOD-1)%MOD);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |