# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1077617 |
2024-08-27T08:22:57 Z |
kchu_z |
Tents (JOI18_tents) |
C++17 |
|
2 ms |
604 KB |
#include <bits/stdc++.h>
using namespace std;
long long dp[3001][3001];
bool visited[3001][3001];
long long f(int n, int m) {
if (n <= 1 && m <= 1) return 1;
if (visited[n][m]) return dp[n][m];
visited[n][m] = 1;
return dp[n][m] = f(n, m - 1) + 4 * m * f(n - 1, m - 1) + f(n - 1, m - 2) * m * (m - 1) / 2 + f(n - 2, m - 1) * m * (n - 1);
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, m;
cin >> n >> m;
cout << f(n, m) - 1 << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |