# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
745529 | mohav48173 | Permutation (APIO22_perm) | C++17 | 2 ms | 468 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"
using namespace std;
vector<int> construct_permutation(long long k) {
deque<int>ans;
vector<bool>bits;
while(k>0) {
if(k%2)bits.push_back(1);
else bits.push_back(0);
k/=2;
}
reverse(bits.begin(),bits.end());
int cur=0;
for(int i=0;i<bits.size();i++) {
if(i==0)continue;
ans.push_back(cur++);
if(bits[i])ans.push_front(cur++);
}
vector<int>anss;
for(int i:ans)anss.push_back(i);
return anss;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |