제출 #741050

#제출 시각아이디문제언어결과실행 시간메모리
741050NemanjaSo2005캥거루 (CEOI16_kangaroo)C++14
6 / 100
1 ms340 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; const ll MOD=1e9+7; ll dp[2005][2005],S,T,N,uze; int main(){ cin>>N>>S>>T; dp[1][1]=1; if(S==1 or T==1){ uze=1; } for(int i=2;i<=N;i++){ if(i==S or i==T){ uze++; for(int j=1;j<=N;j++) dp[i][j]=dp[i-1][j-1]+dp[i-1][j]; continue; } for(int j=1;j<=N;j++){ dp[i][j]=(j-uze)*dp[i-1][j-1] + j*dp[i-1][j+1]; } } cout<<dp[N][1]<<"\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...