이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
//Be Name KHODA
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back
#define pp pop_back
#define lb lower_bound
#define ub upper_bound
#define cl clear
#define bg begin
#define arr(x) array<int , x>
#define endl '\n'
const int MOD = int(1e9) + 7;
int n , m;
ll dp[3001][3001];
int main(){
cin >> n >> m;
dp[n][m] = 1;
for(int i = n ; i > 0 ; i--){
for(int j = m ; j >= 0 ; j--){
dp[i][j] %= MOD;
dp[i - 1][j] += dp[i][j];
if(m > 0){
dp[i - 1][j - 1] += j * 4 * dp[i][j];
if(i > 1) dp[i - 2][j - 1] += j * (i - 1) * dp[i][j];
}
if(m > 1) dp[i - 1][j - 2] += j * (j - 1) / 2 * dp[i][j];
}
}
ll o = 0;
for(int j = m - 1 ; j >= 0 ; j--) o += dp[0][j];
cout << o % MOD;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |