# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
810954 | 2023-08-06T18:10:15 Z | vjudge1 | Tents (JOI18_tents) | C++17 | 1 ms | 340 KB |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; const int MOD = 1e9 + 7; vector<vector<int64_t>> f(n + 1, vector<int64_t>(m + 1, 1)); for (int i = 1; i <= n; i++) { for (int j = 0; j <= m; j++) { f[i][j] = f[i - 1][j]; if (j > 0) (f[i][j] += f[i - 1][j - 1] * j * 4) %= MOD; if (i > 1) (f[i][j] += f[i - 2][j - 1] * (i - 1) * j) %= MOD; if (j > 1) (f[i][j] += f[i - 1][j - 2] * j * (j - 1) / 2) % MOD; } } cout << (f[n][m] + MOD - 1) % MOD; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Incorrect | 1 ms | 340 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 340 KB | Output is correct |
5 | Incorrect | 1 ms | 340 KB | Output isn't correct |
6 | Halted | 0 ms | 0 KB | - |