제출 #610401

#제출 시각아이디문제언어결과실행 시간메모리
610401Arnch캥거루 (CEOI16_kangaroo)C++17
6 / 100
2086 ms212 KiB
// oooo
/*
 har chi delet mikhad bebar ~
 gitar o ba khodet nabar! ~
 ;Amoo_Hasan;
*/

#include<bits/stdc++.h>
//#pragma GCC optimize("O3,no-stack-protector,unroll-loops")
//#pragma GCC target("avx2,fma")

using namespace std;

typedef long long ll;
typedef long double ld;

#define Sz(x) int((x).size())
#define All(x) (x).begin(), (x).end()
#define wtf(x) cout<<#x <<" : " <<x <<endl

constexpr ll inf = 1e18, N = 1e6 + 10, mod = 1e9 + 7, pr = 1000696969;


int main() {
    ios :: sync_with_stdio(0), cin.tie(0);

	int n, s, e; cin >>n >>s >>e;

	vector<int> vc;
	for(int i = 1; i <= n; i++) vc.push_back(i);

	int ans = 0;

	do {
		if(vc[0] != s || vc.back() != e) continue;
	
		bool t = (vc[1] > vc[0]), ex = 0;
		for(int i = 2; i < Sz(vc); i++) {
			bool t2 = (vc[i] > vc[i - 1]);
			if(t2 == t) {
				ex = 1;
				break;
			}
			t = t2;
		}

		if(!ex) ans++;

	} while(next_permutation(All(vc)));

	cout<<ans;

    return 0;
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...