Submission #24610

# Submission time Handle Problem Language Result Execution time Memory
24610 2017-06-10T18:12:32 Z jiangzhi Kangaroo (CEOI16_kangaroo) C++11
Compilation error
0 ms 0 KB
#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);
}

Compilation message

kangaroo.cpp: In function 'int main()':
kangaroo.cpp:22:14: error: expected primary-expression before ';' token
   if(ok)ans=+;
              ^
kangaroo.cpp:24:35: error: 'next_permutation' was not declared in this scope
  }while(next_permutation(vec,vec+n));
                                   ^
kangaroo.cpp:8:34: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("kangaroo.in","r",stdin);
                                  ^
kangaroo.cpp:9:36: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("kangoroo.out","w",stdout);
                                    ^
kangaroo.cpp:11:27: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &n,&s,&e);
                           ^
kangaroo.cpp:13:23: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &vec[i]);
                       ^