Submission #1118047

#TimeUsernameProblemLanguageResultExecution timeMemory
1118047vjudge1Kangaroo (CEOI16_kangaroo)C++17
0 / 100
1 ms336 KiB
//Desinged by AzeTurk810 Open source #include <bits/stdc++.h> using namespace std; # define ull unsigned long long # define hurryup ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) # define endl '\n' # define pb push_back # define INF 1e10 # define vbol vector<bool> # define vint vector<int> # define ll long long # define int long long # define mod 1000000007 const int up = 202; int dp[2][up][up][up]; signed main() { int n,cs,cf,fixed = 0; cin>>n>>cs>>cf; vector<vector<int>>dp (n + 1,vector<int>(n + 1,0)); dp[1][1] = 1; for(int i=1;i<=n;i++) { if(cs == i || cf == i) fixed++; for(int j=1;j<=n;j++) { if(cs == i || cf == i) { dp[i][j + 1] += dp[i - 1][j]; dp[i][j] += dp[i - 1][j]; } else { dp[i][j + 1] += dp[i - 1][ j ] * (j-fixed + 1); dp[i][ j -1] += dp[i -1 ][j] *(j - fixed + 1); } dp[i][j] %= mod; } } cout<<dp[n][1]<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...