# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1118744 | Username_taken12 | Permutation (APIO22_perm) | C++17 | 1 ms | 348 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) {
//int cnt = std::popcount((unsigned long long) k);
int cnt=0;
int size =0;
long long t=k;
while(t>0){
size++;
t/=2;
if(t%2==1)
cnt++;
}
cnt--;
int len = size+cnt;
int h=len-1;
int a =0;
vector<int> out;
while(k>0){
if(k%2==1&&k!=1)
out.push_back(h--);
out.push_back(a++);
k/=2;
}
return out;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |