# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164316 | str0ct | Tents (JOI18_tents) | C++14 | 387 ms | 59384 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;
using ll=long long;
const ll mod=1e9+7;
ll dp[3030][3030];
ll f(ll col,ll row){
//printf("%d%d\n",col,row);
if(col<0||row<0)return 0;
if(col==0||row==0)return 1;
if(dp[col][row])return dp[col][row];
dp[col][row]+=(f(col-1,row)+4*row*f(col-1,row-1))%mod;
dp[col][row]%=mod;
dp[col][row]+=(row*(row-1)/2*f(col-1,row-2)+row*(col-1)*f(col-2,row-1))%mod;
dp[col][row]%=mod;
return dp[col][row];
}
int main(){
ll H,W;
scanf("%lld%lld",&H,&W);
printf("%lld",f(H,W)-1);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |