#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 |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Execution timed out |
2082 ms |
204 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Execution timed out |
2082 ms |
204 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Execution timed out |
2082 ms |
204 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |