# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
596416 | slime | Permutation (APIO22_perm) | C++17 | 4 ms | 392 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 "perm.h"
#include "bits/stdc++.h"
using namespace std;
std::vector<int> construct_permutation(long long k)
{
vector<int> cur = {};
vector<int> bit;
bool begin = 0;
for(int i = 59; i >= 0; i--) {
if(k & (1ll << i)) {
bit.push_back(1);
begin = 1;
}
else if(begin) bit.push_back(0);
}
for(int i = 1; i < bit.size(); i++) {
int n = cur.size();
cur.push_back(n);
if(bit[i]) {
n = cur.size();
vector<int> new_;
new_.push_back(n);
for(int x: cur )new_.push_back(x);
cur = new_;
}
}
return cur;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |