# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
24610 | jiangzhi | Kangaroo (CEOI16_kangaroo) | C++11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <cstdio>
const int N = 2010;
int vec[N];
int main(){
freopen("kangaroo.in","r",stdin);
freopen("kangoroo.out","w",stdout);
int n,s,e;
scanf("%d%d%d", &n,&s,&e);
for(int i = 1; i <= n ;i++){
scanf("%d", &vec[i]);
}
int ans = 0;
do{
if(s!=vec[0] || e != vec[n-1])continue;
int ok = 1;
for(int i = 0; i < n-2; i++){
if((vec[i] - vec[i+1] > 0) == (vec[i+1] - vec[i+2] >0))ok=0;
}
if(ok)ans=+;
}while(next_permutation(vec,vec+n));
printf("%d\n",ans);
}