# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44119 | khsoo01 | Tents (JOI18_tents) | C++11 | 84 ms | 71168 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 ll N = 3005, M = 1e9+7;
ll h, w, dt[N][N];
int main()
{
scanf("%lld%lld",&h,&w);
for(ll i=0;i<=w;i++) dt[0][i] = 1;
for(ll i=1;i<=h;i++) {
dt[i][0] = 1;
for(ll j=1;j<=w;j++) {
dt[i][j] = dt[i-1][j] + 4*j*dt[i-1][j-1];
if(i >= 2) dt[i][j] += dt[i-2][j-1]*j*(i-1);
if(j >= 2) dt[i][j] += dt[i-1][j-2]*j*(j-1)/2;
dt[i][j] %= M;
}
}
printf("%lld\n",(dt[h][w]+M-1)%M);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |