# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
874126 | green_gold_dog | Permutation (APIO22_perm) | C++17 | 2 ms | 600 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>
#include "perm.h"
typedef long long ll;
using namespace std;
std::vector<int> construct_permutation(long long k)
{
deque<ll> d;
d.push_back(0);
ll na = 2;
vector<ll> bits;
while (k) {
bits.push_back(k % 2);
k /= 2;
}
bits.pop_back();
bool b = false;
ll now = 1;
while (!bits.empty()) {
if (b) {
d.push_back(now);
now++;
}
b = true;
if (bits.back()) {
d.push_front(now);
now++;
}
bits.pop_back();
}
vector<int> ans;
for (auto i : d) {
ans.push_back(i);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |