이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cstdlib>
using namespace std;
typedef long long llong;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<llong, llong> pll;
const int mod = 1e9 + 7;
int dp[3001][3001];
void add(int &x, int y) {
x = (x + y) % mod;
}
int mul(int x, int y) {
return (llong)x * y % mod;
}
int main() {
int n, m;
scanf("%d%d", &n, &m);
dp[0][m] = 1;
for (int i = 1; i <= n; ++i) {
for (int j = 0; j <= m; ++j) {
add(dp[i][j], dp[i - 1][j]);
if (j < 1) continue;
add(dp[i][j - 1], mul(dp[i - 1][j], 4 * j));
if (i < n) add(dp[i + 1][j - 1], mul(dp[i - 1][j], (n - i) * j));
if (j < 2) continue;
add(dp[i][j - 2], mul(dp[i - 1][j], j * (j - 1) >> 1));
}
}
int ans = 0;
for (int i = 0; i < m; ++i) add(ans, dp[n][i]);
printf("%d\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
tents.cpp: In function 'int main()':
tents.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &n, &m);
~~~~~^~~~~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |