# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
164045 | georgerapeanu | Tents (JOI18_tents) | C++11 | 149 ms | 35576 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
#include <algorithm>
using namespace std;
const int XMAX = 3000;
const int MOD = 1e9 + 7;
int dp[XMAX + 5][XMAX + 5];
int main(){
for(int i = 0;i <= XMAX + 2;i++){
dp[i][0] = dp[0][i] = 1;
}
int h,w;
scanf("%d %d",&h,&w);
for(int i = 1;i <= h;i++){
for(int j = 1;j <= w;j++){
dp[i][j] = dp[i - 1][j];
dp[i][j] = (dp[i][j] + 4LL * dp[i - 1][j - 1] * j) % MOD;
if(j > 1)dp[i][j] = (dp[i][j] + 1LL * dp[i - 1][j - 2] * j * (j - 1) / 2) % MOD;
if(i > 1)dp[i][j] = (dp[i][j] + 1LL * dp[i - 2][j - 1] * j * (i - 1)) % MOD;
}
}
printf("%d\n",(dp[h][w] == 0 ? MOD - 1:dp[h][w] - 1));
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |