# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
872648 | salmon | Permutation (APIO22_perm) | C++17 | 1 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 "perm.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k){
vector<int> v;
deque<int> dq;
vector<int> bits;
int cont = 0;
while(k != 0){
bits.push_back(k % 2);
k /= 2;
}
reverse(bits.begin(),bits.end());
for(int i = 0; i < bits.size(); i++){
if(bits[i] == 1){
dq.push_front(cont);
dq.push_back(cont - 1);
cont -= 2;
}
else{
dq.push_front(cont);
cont--;
}
}
for(int i : dq){
v.push_back(i - cont);
}
return v;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |