Submission #920464

# Submission time Handle Problem Language Result Execution time Memory
920464 2024-02-02T15:06:11 Z adaawf Tents (JOI18_tents) C++14
100 / 100
137 ms 70816 KB
#include <iostream>
using namespace std;
long long int f[3005][3005], mod = 1e9 + 7;
int main() {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            if (i == 0 || j == 0) f[i][j] = 1;
            else {
                f[i][j] = f[i - 1][j];
                f[i][j] += f[i - 1][j - 1] * j * 4;
                if (j >= 2) f[i][j] += f[i - 1][j - 2] * (j * (j - 1) / 2) % mod;
                if (i >= 2) f[i][j] += f[i - 2][j - 1] * (i - 1) * j;
                f[i][j] %= mod;
            }
        }
    }
    cout << (f[n][m] + mod - 1) % mod;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 4564 KB Output is correct
10 Correct 2 ms 8540 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 3 ms 8540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 6492 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 2 ms 6492 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 6492 KB Output is correct
9 Correct 1 ms 4564 KB Output is correct
10 Correct 2 ms 8540 KB Output is correct
11 Correct 1 ms 2392 KB Output is correct
12 Correct 3 ms 8540 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 10 ms 55824 KB Output is correct
15 Correct 89 ms 66216 KB Output is correct
16 Correct 6 ms 6492 KB Output is correct
17 Correct 19 ms 16976 KB Output is correct
18 Correct 25 ms 29272 KB Output is correct
19 Correct 101 ms 70588 KB Output is correct
20 Correct 81 ms 57996 KB Output is correct
21 Correct 53 ms 39504 KB Output is correct
22 Correct 54 ms 51816 KB Output is correct
23 Correct 34 ms 70480 KB Output is correct
24 Correct 137 ms 70816 KB Output is correct
25 Correct 103 ms 62076 KB Output is correct
26 Correct 117 ms 68180 KB Output is correct
27 Correct 131 ms 70320 KB Output is correct