| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 314364 | ivan_tudor | 캥거루 (CEOI16_kangaroo) | C++14 | 22 ms | 14080 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int N=2005;
const int MOD=1000000007;
int dp[N][N];
inline void trans(long long val,int id,int col){
if(col<0)
return;
val%=MOD;
dp[id][col]+=val;
if(dp[id][col]>MOD)
dp[id][col]-=MOD;
}
int main()
{
int n,cs,cf;
scanf("%d%d%d",&n,&cs,&cf);
if(cf<cs)
swap(cf,cs);
dp[1][0]=1;
for(int i=1;i<cs;i++){
for(int j=0;j<i;j++){
trans(dp[i][j],i+1,j+1);
trans(1LL*dp[i][j]*(j-1)*j,i+1,j-1);
}
}
for(int j=0;j<cs;j++){
trans(dp[cs][j],cs+1,j);
trans(1LL*dp[cs][j]*j,cs+1,j-1);
}
for(int i=cs+1;i<cf;i++){
for(int j=0;j<i;j++){
trans(dp[i][j],i+1,j+1);
trans(1LL*dp[i][j]*(j)*j,i+1,j-1);
}
}
for(int j=0;j<cf;j++){
trans(dp[cf][j],cf+1,j);
trans(1LL*dp[cf][j]*j,cf+1,j-1);
}
for(int i=cf+1;i<=n;i++){
for(int j=0;j<i;j++){
trans(dp[i][j],i+1,j+1);
trans(1LL*dp[i][j]*(j+1)*j,i+1,j-1);
}
}
printf("%d",dp[n][0]);
return 0;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
