# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
725190 | Batorgil952 | Permutation (APIO22_perm) | C++17 | 1 ms | 212 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;
std::vector<int> construct_permutation(long long k)
{
vector< int > v;
long long a[62], b[62];
long long m=k, f=-1, r;
for(long long i=0; i<=59; i++){
if(m%2==1){
a[i]=1;
}
m/=2;
}
for(long long i=59; i>=0; i--){
if(a[i]>0){
if(f==-1){
f=i;
r=f;
}
else{
b[i]=f;
f++;
}
}
}
for(long long i=0; i<=59; i++){
if(b[i]>0) v.push_back(b[i]);
if(i<r) v.push_back(i);
}
return v;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |