# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
810955 |
2023-08-06T18:10:39 Z |
vjudge1 |
Tents (JOI18_tents) |
C++17 |
|
77 ms |
70876 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;
}
# |
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 |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
1 ms |
448 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
572 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
980 KB |
Output is correct |
# |
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 |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
468 KB |
Output is correct |
7 |
Correct |
1 ms |
448 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
572 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
980 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
444 KB |
Output is correct |
15 |
Correct |
49 ms |
44132 KB |
Output is correct |
16 |
Correct |
4 ms |
3128 KB |
Output is correct |
17 |
Correct |
11 ms |
10068 KB |
Output is correct |
18 |
Correct |
14 ms |
12500 KB |
Output is correct |
19 |
Correct |
56 ms |
51464 KB |
Output is correct |
20 |
Correct |
44 ms |
41136 KB |
Output is correct |
21 |
Correct |
33 ms |
27220 KB |
Output is correct |
22 |
Correct |
41 ms |
26836 KB |
Output is correct |
23 |
Correct |
17 ms |
15060 KB |
Output is correct |
24 |
Correct |
77 ms |
70876 KB |
Output is correct |
25 |
Correct |
58 ms |
52668 KB |
Output is correct |
26 |
Correct |
65 ms |
60280 KB |
Output is correct |
27 |
Correct |
75 ms |
68084 KB |
Output is correct |