이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
using namespace std;
using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
int const nmax = 3000;
int const modulo = 1000000007;
int dp[1 + nmax][1 + nmax];
int extract(int i, int j){
if(i < 0 || j < 0)
return 0;
else if(i == 0 || j == 0)
return 1;
else if(dp[i][j] == 0){
dp[i][j] = (extract(i - 1, j) +
1LL * extract(i - 1, j - 1) * (j * 4) +
1LL * extract(i - 1, j - 2) * ((j * (j - 1)) / 2) +
1LL * extract(i - 2, j - 1) * j * (i - 1)) % modulo;
}
return dp[i][j];
}
int main()
{
int n, m;
cin >> n >> m;
cout << (modulo + extract(n, m) - 1) % modulo;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |