# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
57139 | kriii | Tents (JOI18_tents) | C++17 | 142 ms | 71716 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 <stdio.h>
const long long mod = 1000000007;
long long d[3030][3030];
int main()
{
int N,M; scanf ("%d %d",&N,&M);
for (int i=0;i<=N;i++) for (int j=0;j<=M;j++){
if (i == 0 || j == 0) d[i][j] = 1;
else{
d[i][j] = (d[i-1][j] + d[i-1][j-1] * j * 4) % mod;
if (i >= 2) d[i][j] = (d[i][j] + d[i-2][j-1] * (i - 1) * j) % mod;
if (j >= 2) d[i][j] = (d[i][j] + d[i-1][j-2] * j * (j - 1) / 2) % mod;
}
}
printf ("%lld\n",(d[N][M]+mod-1)%mod);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |