# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1117807 | vjudge1 | Kangaroo (CEOI16_kangaroo) | C++17 | 3 ms | 592 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("O3")
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define AI ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
using namespace std;
vector<ll>val;
vector<vector<ll>>edge;
vector<ll>check;
ll k,c=0;
int main()
{
AI
freopen("kangaroo.in", "r", stdin);
freopen("kangaroo.out", "w", stdout);
ll n,a,b,i,j,per=0;
cin>>n>>a>>b;
vector<ll>v(n);
for(i=1;i<=n;i++)
v[i-1]=i;
do
{
if(v[0]!=a or v[n-1]!=b)
continue;
bool bo=true;
for(i=1;i<n;i++)
{
if(i>2 and ((v[i-2]<v[i-1] and v[i-1]<v[i]) or (v[i-2]>v[i-1] and v[i-1]>v[i])))
{
bo=false;
break;
}
}
if(bo)
per++;
}while(next_permutation(v.begin(),v.end()));
cout<<per;
}
Compilation message (stderr)
# | 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... |