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 "perm.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<int> construct_permutation(long long k){
deque<int> dq;
int sbt = __lg(k);
int cur = 0;
for(int i = sbt - 1; i >= 0; i--){
dq.push_back(cur++);
if((k >> i) & 1) {
dq.push_front(cur++);
}
}
vector<int> ret = {};
for(auto e : dq){
ret.push_back(e);
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |