제출 #1033949

#제출 시각아이디문제언어결과실행 시간메모리
1033949BuzzyBeezTents (JOI18_tents)C++17
100 / 100
62 ms70996 KiB
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; long long dp[3008][3008]; long long C2(int x) {return (1LL * x * (x - 1) / 2) % mod;} signed main() { int n, m; cin >> n >> m; for (int i = 0; i <= m; ++i) dp[0][i] = 1; for (int i = 0; i <= n; ++i) dp[i][0] = 1; for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) dp[i][j] = (dp[i][j - 1] + dp[i - 1][j - 1] * i * 4 + dp[i - 2][j - 1] * C2(i) + dp[i - 1][j - 2] * i * (j - 1)) % mod; cout << (dp[n][m] + mod -1 ) % mod; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...