제출 #604448

#제출 시각아이디문제언어결과실행 시간메모리
604448HappyPacMan캥거루 (CEOI16_kangaroo)C++14
6 / 100
2076 ms284 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	int N,cs,cf;
	cin >> N >> cs >> cf;
	vector<int> vec(N);
	iota(vec.begin(),vec.end(),1);
	int ans = 0;
	do{
		if(vec[0] == cs && vec.back() == cf){
			bool valid = true;
			for(int i=1;i<N-1;i++){
				if(vec[i] > min(vec[i+1],vec[i-1]) && vec[i] < max(vec[i+1],vec[i-1])){
					valid = false;
				}
			}
			ans += valid;
		}
	}while(next_permutation(vec.begin(),vec.end()));
	cout << ans << "\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...