Submission #920464

#TimeUsernameProblemLanguageResultExecution timeMemory
920464adaawfTents (JOI18_tents)C++14
100 / 100
137 ms70816 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...