# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
44367 | choikiwon | Tents (JOI18_tents) | C++17 | 429 ms | 36324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int H, W;
int cc[3010][3010];
int dp(int r, int c) {
int &ret = cc[r][c];
if(ret != -1) return ret;
if(!r || !c) return ret = 1;
ret = 0;
ret += dp(r - 1, c);
ret %= mod;
if(r >= 1) {
ret += 1LL * 4 * c % mod * dp(r - 1, c - 1) % mod;
ret %= mod;
}
if(r >= 2) {
ret += 1LL * (r - 1) * c % mod * dp(r - 2, c - 1) % mod;
ret %= mod;
}
if(c >= 2) {
ret += 1LL * (c * (c - 1) / 2) * dp(r - 1, c - 2) % mod;
ret %= mod;
}
return ret;
}
int main() {
scanf("%d %d", &H, &W);
memset(cc, -1, sizeof(cc));
printf("%d", dp(H, W) - 1);
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |