이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define Debug(...) fprintf(stderr, __VA_ARGS__)
typedef long long LL;
typedef long double LD;
typedef unsigned int uint;
typedef pair <int, int> pii;
typedef unsigned long long uLL;
template <typename T> inline void Read(T &x) {
  char c = getchar();
  bool f = false;
  for (x = 0; !isdigit(c); c = getchar()) {
    if (c == '-') {
      f = true;
    }
  }
  for (; isdigit(c); c = getchar()) {
    x = x * 10 + c - '0';
  }
  if (f) {
    x = -x;
  }
}
template <typename T> inline bool CheckMax(T &a, const T &b) {
  return a < b ? a = b, true : false;
}
template <typename T> inline bool CheckMin(T &a, const T &b) {
  return a > b ? a = b, true : false;
}
const int N = 3005;
const int mod = 1e9 + 7;
int n, m, ans, f[N][N];
int main() {
#ifdef wxh010910
  freopen("d.in", "r", stdin);
#endif
  Read(n), Read(m), f[0][m] = 1;
  for (int i = 1; i <= n; ++i) {
    for (int j = 0; j <= m; ++j) {
      f[i][j] = (1LL * (j + 2) * (j + 1) / 2 * f[i - 1][j + 2] + 4LL * (j + 1) * f[i - 1][j + 1] + f[i - 1][j]) % mod;
      if (i >= 2) {
        f[i][j] = (1LL * (i - 1) * (j + 1) * f[i - 2][j + 1] + f[i][j]) % mod;
      }
    }
  }
  for (int i = 0; i <= m; ++i) {
    ans = (ans + f[n][i]) % mod;
  }
  printf("%d\n", (ans + mod - 1) % mod);
#ifdef wxh010910
  Debug("My Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
  return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |