이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int h,w;
int memo[3001][3001];
long long dp(int a,int b){
if (a<=0 || b<=0) return 1;
if (memo[a][b]!=0) return memo[a][b];
long long ans=0;
ans+=dp(a-1,b);
ans+=4*b*dp(a-1,b-1);
ans+=((b*(b-1))/2)*dp(a-1,b-2);
ans+=(b*(a-1))*dp(a-2,b-1);
ans%=1000000007;
return memo[a][b]=ans;
}
int main() {
cin>>h>>w;
cout<<dp(h,w)-1;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |