Submission #172808

# Submission time Handle Problem Language Result Execution time Memory
172808 2020-01-02T16:23:07 Z Akashi Tents (JOI18_tents) C++14
100 / 100
125 ms 35672 KB
#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

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 376 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 1400 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 1 ms 1272 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 1144 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 5 ms 1912 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 3 ms 1144 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 3 ms 1400 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 1 ms 1272 KB Output is correct
8 Correct 2 ms 632 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 3 ms 1144 KB Output is correct
11 Correct 3 ms 1528 KB Output is correct
12 Correct 5 ms 1912 KB Output is correct
13 Correct 7 ms 7672 KB Output is correct
14 Correct 1 ms 376 KB Output is correct
15 Correct 82 ms 24104 KB Output is correct
16 Correct 12 ms 7928 KB Output is correct
17 Correct 25 ms 12408 KB Output is correct
18 Correct 28 ms 11768 KB Output is correct
19 Correct 94 ms 26616 KB Output is correct
20 Correct 79 ms 25336 KB Output is correct
21 Correct 57 ms 22008 KB Output is correct
22 Correct 54 ms 18684 KB Output is correct
23 Correct 28 ms 7672 KB Output is correct
24 Correct 125 ms 35672 KB Output is correct
25 Correct 98 ms 30584 KB Output is correct
26 Correct 111 ms 32420 KB Output is correct
27 Correct 122 ms 35336 KB Output is correct