제출 #932843

#제출 시각아이디문제언어결과실행 시간메모리
932843Aiperiii캥거루 (CEOI16_kangaroo)C++14
100 / 100
27 ms31836 KiB
#include <bits/stdc++.h> #define int long long #define ff first #define ss second #define all(x) x.begin(),x.end() #define pb push_back using namespace std; const int N=2005,mod=1e9+7; int dp[N][N]; signed main(){ ios_base::sync_with_stdio(); cin.tie(0);cout.tie(0); int n,s,t; cin>>n>>s>>t; dp[0][0]=1; for(int i=1;i<=n;i++){ for(int j=1;j<=n;j++){ if(i==s or i==t)dp[i][j]=dp[i-1][j]+dp[i-1][j-1]%mod; else{ int x=0; if(i>s)x++; if(i>t)x++; dp[i][j]=dp[i-1][j+1]*j%mod; dp[i][j]+=dp[i-1][j-1]*(j-x)%mod; } } } cout<<dp[n][1]<<"\n"; } /* */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...