# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
172808 | Akashi | Tents (JOI18_tents) | C++14 | 125 ms | 35672 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 MOD = 1e9 + 7;
int n, m;
int d[3005][3005];
int main()
{
// freopen("1.in", "r", stdin);
scanf("%d%d", &n, &m);
d[0][n] = 1;
for(int c = 1; c <= m ; ++c){
for(int l = 0; l <= n ; ++l){
d[c][l] = d[c - 1][l];
d[c][l] = (d[c][l] + 4LL * (l + 1) * d[c - 1][l + 1]) % MOD;
d[c][l] = (d[c][l] + 1LL * (1LL * (l + 2) * (l + 1) / 2) % MOD * d[c - 1][l + 2]) % MOD;
if(c > 1) d[c][l] = (d[c][l] + (1LL * (m - c + 1) * (l + 1)) % MOD * d[c - 2][l + 1]) % MOD;
}
}
int Sol = -1;
for(int l = 0; l <= n ; ++l)
Sol = (Sol + d[m][l]) % MOD;
printf("%d", Sol);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |