Submission #951453

# Submission time Handle Problem Language Result Execution time Memory
951453 2024-03-22T01:49:07 Z star Tents (JOI18_tents) C++14
100 / 100
32 ms 71020 KB
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define N 1000000007
LL dp[3005][3005], n, m, i, j;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    cin >> n >> m;
    for(i=0; i<=3000; i++)
        dp[i][0] = dp[0][i] = 1;
    for(i=1; i<=n; i++)
        for(j=1; j<=m; j++)
        {
            dp[i][j]=dp[i-1][j];
            if (j>=2)dp[i][j]+=(j*(j-1)/2*dp[i-1][j-2]);
            dp[i][j]+=4*j*dp[i-1][j-1];
            if (i>=2)dp[i][j]+=dp[i-2][j-1]*j*(i-1);
            dp[i][j]%=N;
        }

    cout << dp[n][m]-1;
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 70232 KB Output is correct
2 Correct 9 ms 70232 KB Output is correct
3 Correct 9 ms 70236 KB Output is correct
4 Correct 8 ms 70488 KB Output is correct
5 Correct 8 ms 70200 KB Output is correct
6 Correct 8 ms 70236 KB Output is correct
7 Correct 9 ms 70236 KB Output is correct
8 Correct 8 ms 70236 KB Output is correct
9 Correct 8 ms 70232 KB Output is correct
10 Correct 9 ms 70236 KB Output is correct
11 Correct 8 ms 70236 KB Output is correct
12 Correct 8 ms 70360 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 70232 KB Output is correct
2 Correct 9 ms 70232 KB Output is correct
3 Correct 9 ms 70236 KB Output is correct
4 Correct 8 ms 70488 KB Output is correct
5 Correct 8 ms 70200 KB Output is correct
6 Correct 8 ms 70236 KB Output is correct
7 Correct 9 ms 70236 KB Output is correct
8 Correct 8 ms 70236 KB Output is correct
9 Correct 8 ms 70232 KB Output is correct
10 Correct 9 ms 70236 KB Output is correct
11 Correct 8 ms 70236 KB Output is correct
12 Correct 8 ms 70360 KB Output is correct
13 Correct 8 ms 70232 KB Output is correct
14 Correct 8 ms 70212 KB Output is correct
15 Correct 22 ms 70500 KB Output is correct
16 Correct 9 ms 70488 KB Output is correct
17 Correct 11 ms 70352 KB Output is correct
18 Correct 12 ms 70236 KB Output is correct
19 Correct 25 ms 70396 KB Output is correct
20 Correct 22 ms 70504 KB Output is correct
21 Correct 17 ms 70440 KB Output is correct
22 Correct 17 ms 70236 KB Output is correct
23 Correct 15 ms 70540 KB Output is correct
24 Correct 32 ms 71020 KB Output is correct
25 Correct 25 ms 70492 KB Output is correct
26 Correct 28 ms 70488 KB Output is correct
27 Correct 30 ms 70492 KB Output is correct