This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
#define endl "\n"
using namespace std;
signed main(){
int n,cs,cf;
cin>>n>>cs>>cf;
vector<int>arr(n);
for(int i=0;i<n;i++)
arr[i]=i+1;
int ans=0;
do{
if(arr[0]!=cs)continue;
if(arr[n-1]!=cf)continue;
for(int i=1;i<n-1;i++){
bool a1=arr[i]<arr[i-1];
bool a2=arr[i]<arr[i+1];
if(~(a1^a2))continue;
}
ans++;
}while(next_permutation(arr.begin(),arr.end()));
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |