Submission #1118084

#TimeUsernameProblemLanguageResultExecution timeMemory
1118084vjudge1Kangaroo (CEOI16_kangaroo)C++17
0 / 100
1 ms336 KiB
#pragma GCC optimize("O3")// ceoi 2016 day 1 p2//03:11 11-25-2024 #include<bits/stdc++.h> #define ll long long #define endl "\n" #define AI ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); using namespace std; ll dp[1001][1001]; int main() { AI //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); ll n,cs,cf,fixe=0,i,j; cin>>n; cin>>cs>>cf; dp[1][1]=1; for(i=1;i<=n;i++) { for(j=1;j<i;j++) { if(i==cs or i==cf) { dp[i][j+1]+=dp[i-1][j]; dp[i][j]+=dp[i-1][j]; fixe++; } else { dp[i][j+1]+=dp[i-1][j]*(j-fixe+1); dp[i][j-1]+=dp[i-1][j]*(j-1); } } } cout<<dp[n][1]; } /* Thanks to Rashad Mammadov */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...