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>
#include "perm.h"
#define int long long
using namespace std;
vector<int32_t> construct_permutation(int k) {
deque<int> ans;
k--;
int curr = 0;
for (int i = 0; i < 60; i++) {
deque<int> toadd;
if ((1LL << i) & k) {
for (int j = 0; j < i; j++) toadd.push_back(curr++);
toadd.push_front(curr++);
}
reverse(toadd.begin(), toadd.end());
for (auto u : toadd) ans.push_front(u);
}
vector<int32_t> nans;
for (auto u : ans) nans.push_back(u);
//for (auto u : nans) cout << u << " ";
//cout << "\n";
return nans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |