제출 #605116

#제출 시각아이디문제언어결과실행 시간메모리
605116UncoolAnon캥거루 (CEOI16_kangaroo)C++14
0 / 100
1 ms212 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=2;i+1<n;i++) yes&=((a[i]>a[i-1]&&a[i]>a[i+1])|(a[i]<a[i-1]&&a[i]<a[i+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...