Submission #605124

#TimeUsernameProblemLanguageResultExecution timeMemory
605124UncoolAnonKangaroo (CEOI16_kangaroo)C++14
0 / 100
1 ms256 KiB
#include <bits/stdc++.h> #define pii pair<int,int> #define F first #define S second #define mp make_pair using namespace std; int main(){ int n,s,f; cin>>n>>s>>f; vector<int> a; for(int i=1;i<=n;i++) a.push_back(i); int answer=0; do{ if(a[0]==s&&a.back()==f){ bool yes=1; for(int i=1;i+1<n;i++) if((a[i]>a[i-1]&&a[i]>a[i+1])||(a[i]<a[i-1]&&a[i]<a[i+1])) yes=1; answer+=yes; } }while(next_permutation(a.begin(),a.end())); cout<<answer; 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...