Submission #465452

#TimeUsernameProblemLanguageResultExecution timeMemory
465452osmanallazovKangaroo (CEOI16_kangaroo)C++14
6 / 100
2082 ms204 KiB
#include<bits/stdc++.h> using namespace std; int v[11]; int ans; int main(){ int n,cs,cf; cin>>n>>cs>>cf; for(int i=0;i<n;i++){ v[i]=i+1; } do{ if(cs!=v[0] || cf!=v[n-1]) continue; int f=1; for(int i=0;i<n-2;i++){ if((v[i]-v[i+1]>0)==(v[i+1]-v[i+2]>0)) f=0; } if(f) ans++; }while(next_permutation(v,v+n)); cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...