# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72578 | Abelyan | Tents (JOI18_tents) | C++17 | 137 ms | 71364 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <queue>
#include <map>
#include <set>
#include <cmath>
using namespace std;
typedef long long ll;
const int N = 3006;
const ll MOD = 1000000007;
ll dp[N][N];
int main() {
ios_base::sync_with_stdio(false);
int n,m;
cin >> n >> m;
for (int i = 1; i <= max(n,m); i++) {
dp[0][i]=dp[i][0] = 1;
dp[1][i]=dp[i][1] = i*(i - 1) / 2 + 4 * i + 1;
}
for (ll i = 2; i <= n; i++) {
for (ll j = 2; j <= m; j++) {
dp[i][j] = (i * 4 * dp[i - 1][j - 1] + i*(j - 1)*dp[i - 1][j - 2] + dp[i][j - 1] + (i*(i - 1) / 2) * dp[i - 2][j - 1]) % MOD;
}
}
cout << dp[n][m]-1 << endl;
system("pause");
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |