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>
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 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... |