# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
129373 | DodgeBallMan | 캥거루 (CEOI16_kangaroo) | C++14 | 101 ms | 32248 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
const int mod = 1e9 + 7;
int n, s, e;
long long dp[N][N];
long long solve( int i, int j ) {
if( dp[i][j] != -1 ) return dp[i][j];
if( j == 0 ) return dp[i][j] = 0;
if( i == 1 ) return dp[i][j] = j == 1 ? 1 : 0;
if( i == s || i == e ) return dp[i][j] = ( solve( i-1, j-1 ) + solve( i-1, j ) ) % mod;
return dp[i][j] = ( solve( i-1, j+1 ) * j + solve( i-1, j-1 ) * ( j - ( i > s ? 1 : 0 ) - ( i > e ? 1 : 0 ) ) ) % mod;
}
int main()
{
memset( dp, -1, sizeof dp );
scanf("%d %d %d",&n,&s,&e);
printf("%lld",solve( n, 1 ));
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |