Submission #44125

# Submission time Handle Problem Language Result Execution time Memory
44125 2018-03-30T06:53:58 Z tlwpdus Tents (JOI18_tents) C++11
100 / 100
513 ms 71292 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n, m;
ll dp[3010][3010], MOD = 1e9+7;

int main() {
    int i, j;

    scanf("%d%d",&n,&m);
    for (i=0;i<=m;i++) dp[0][i] = 1;
    for (i=0;i<=n;i++) dp[i][0] = 1;
    for (i=1;i<=n;i++)for (j=1;j<=m;j++) dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]*4*j%MOD + dp[i-2][j-1]*j*(i-1)%MOD + dp[i-1][j-2]*(1LL*j*(j-1)/2)%MOD ) %MOD;
    printf("%lld\n",(dp[n][m]+MOD-1)%MOD);

    return 0;
}

Compilation message

tents.cpp: In function 'int main()':
tents.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&n,&m);
     ~~~~~^~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 556 KB Output is correct
4 Correct 2 ms 1196 KB Output is correct
5 Correct 3 ms 1196 KB Output is correct
6 Correct 3 ms 1512 KB Output is correct
7 Correct 3 ms 1512 KB Output is correct
8 Correct 3 ms 1560 KB Output is correct
9 Correct 2 ms 1560 KB Output is correct
10 Correct 5 ms 1944 KB Output is correct
11 Correct 2 ms 1944 KB Output is correct
12 Correct 7 ms 2328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 380 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 556 KB Output is correct
4 Correct 2 ms 1196 KB Output is correct
5 Correct 3 ms 1196 KB Output is correct
6 Correct 3 ms 1512 KB Output is correct
7 Correct 3 ms 1512 KB Output is correct
8 Correct 3 ms 1560 KB Output is correct
9 Correct 2 ms 1560 KB Output is correct
10 Correct 5 ms 1944 KB Output is correct
11 Correct 2 ms 1944 KB Output is correct
12 Correct 7 ms 2328 KB Output is correct
13 Correct 2 ms 2328 KB Output is correct
14 Correct 7 ms 9884 KB Output is correct
15 Correct 327 ms 55416 KB Output is correct
16 Correct 23 ms 55416 KB Output is correct
17 Correct 98 ms 55416 KB Output is correct
18 Correct 127 ms 55416 KB Output is correct
19 Correct 449 ms 63176 KB Output is correct
20 Correct 344 ms 63176 KB Output is correct
21 Correct 208 ms 63176 KB Output is correct
22 Correct 196 ms 63176 KB Output is correct
23 Correct 115 ms 63176 KB Output is correct
24 Correct 513 ms 71292 KB Output is correct
25 Correct 384 ms 71292 KB Output is correct
26 Correct 434 ms 71292 KB Output is correct
27 Correct 486 ms 71292 KB Output is correct