This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define ll long long
#define all(a) a.begin(), a.end()
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define ull unsigned long long
#define ld long double
#define lv v+v
#define rv v+v+1
#define files freopen("expert.in", "r", stdin), freopen("expert.out", "w", stdout)
using namespace std;
const ll mod = 1e9 + 7;
const ll N = 2e5 + 10;
const ll P = 337ll;
const ld EPS = 1e-9;
const ll block = 450;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
ll n;
cin>>n;
ll cs,cf;
cin>>cs;
cin>>cf;
vector <ll> v;
for(ll i = 1; i<=n; i++) {
v.pb(i);
}
ll ans=0;
do {
vector <ll> check;
if(v[0] != cs) {
continue;
}
if(v[n-1] != cf) {
continue;
}
for(ll i = 1; i<n; i++) {
check.pb(v[i] > v[i-1]);
}
bool ok = true;
for(ll i = 1; i<check.size(); i++) {
ok&=(check[i] != check[i-1]);
}
if(ok) {
ans++;
}
}
while(next_permutation(all(v)));
cout<<ans;
return 0;
}
// equal, min, max, 1, random, build
/*
*/
Compilation message (stderr)
kangaroo.cpp: In function 'int main()':
kangaroo.cpp:45:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
45 | for(ll i = 1; i<check.size(); i++) {
| ~^~~~~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |