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