| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 377224 | CaroLinda | 캥거루 (CEOI16_kangaroo) | C++14 | 28 ms | 23020 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
const int MAXN = 2010 ;
const int MOD = 1e9+7 ;
using namespace std ;
int N , S , T ;
long long dp[MAXN][MAXN] ;
int main()
{
scanf("%d %d %d", &N , &S, &T ) ;
if( S > T ) swap(S,T) ;
dp[0][1] = 1 ;
for(int i = 1 ; i < N ; i++ )
for(int j= 1 ; j <= N-i ; j++ )
{
long long &ptr = dp[i][j] ;
long long fat ;
if( i == T || i == S )
{
ptr = dp[i-1][j+1] + dp[i-1][j] ;
if( ptr >= MOD ) ptr -= MOD ;
continue ;
}
//creating new component
fat = (j-1) + ( i > S ) + (i > T ) ;
ptr = (fat * dp[i-1][j+1] ) % MOD ;
//joining two components
ptr += (dp[i-1][j-1] * (j-1) ) % MOD ;
ptr %= MOD ;
}
long long ans = dp[N-1][1] ;
printf("%lld\n", ans ) ;
}
컴파일 시 표준 에러 (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... | ||||
