# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
388623 | denkendoemeer | Tents (JOI18_tents) | C++14 | 255 ms | 31940 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define mod 1000000007
using namespace std;
#define ll long long
int dp[3005][3005];
ll calc(int a,int b)
{
if (a<=0 || b<=0)
return 1;
if (dp[a][b])
return dp[a][b];
ll ans=0;
ans+=calc(a-1,b);
ans+=(b*(a-1))*calc(a-2,b-1);
ans+=((b*(b-1))/2)*calc(a-1,b-2);
ans+=calc(a-1,b-1)*b*4;
ans=ans%mod;
dp[a][b]=ans;
return ans;
}
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
int n,m;
scanf("%d%d",&n,&m);
printf("%lld\n",calc(n,m)-1);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |