# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1117707 | vjudge1 | Kangaroo (CEOI16_kangaroo) | C++17 | 423 ms | 524288 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.
#include <bits/stdc++.h>
using namespace std;
int main(){
freopen("kangaroo.in","r",stdin);
freopen("kangaroo.out", "w",stdout);
int n,st,ft;
cin >> n >> st >> ft;
vector<int> sira;
for(int i=1;i<=n;++i)sira.push_back(i);
int cnt=0;
do{
if(sira[0] != st || sira[n-1] != ft)continue;
bool flag;
flag = (sira[0] < sira[1]);
bool val = 1;
for(int i=1;i<n-1;++i){
if(flag ^ (sira[i] < sira[i+1])){
flag ^= 1;
continue;
}
val = 0;
continue;
}
cnt += val;
}while(next_permutation(sira.begin(),sira.end()));
cout << cnt;
}
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... |