Submission #24612

# Submission time Handle Problem Language Result Execution time Memory
24612 2017-06-10T18:14:44 Z jiangzhi Kangaroo (CEOI16_kangaroo) C++11
0 / 100
0 ms 1124 KB
#include <cstdio>
#include <algorithm>

using namespace std;



const int N = 2010;

int vec[N];

int main(){
	freopen("kangaroo.in","r",stdin);
	freopen("kangaroo.out","w",stdout);
	int n,s,e;
	scanf("%d%d%d", &n,&s,&e);
	for(int i = 0; i < n ;i++){
		vec[i]=i+1;
	}
	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:13: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:14:36: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
  freopen("kangaroo.out","w",stdout);
                                    ^
kangaroo.cpp:16: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);
                           ^
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1124 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1124 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1124 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 0 ms 1124 KB Execution killed because of forbidden syscall [unknown syscall - gap in table] (292)
2 Halted 0 ms 0 KB -