Submission #72456

#TimeUsernameProblemLanguageResultExecution timeMemory
72456VahanTents (JOI18_tents)C++17
0 / 100
2 ms248 KiB
#include<iostream> using namespace std; long long d[3002][3002], n, m; long long mod = 1000000007; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { d[i][0] = 1; d[i][1] = i*(i - 1) / 2 + 4 * i + 1; } for (int i = 1; i <= m; i++) { d[0][i] = 1; d[1][i] = i*(i - 1) / 2 + 4 * i + 1; } cout << 11 << endl; for (long long i = 2; i <= n; i++) { for (long long j = 2; j <= m; j++) { d[i][j] = ((i*(i - 1) / 2) * d[i - 2][j - 1] + i * 4 * d[i - 1][j - 1] + i*(j - 1)*d[i - 1][j - 2] + d[i][j - 1]) % mod; } } cout << (d[n][m] - 1 + mod) % mod << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...