# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
725198 | Batorgil952 | Permutation (APIO22_perm) | C++17 | 2 ms | 340 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;
int a[62]={0}, b[62]={0};
long long m=k, f=-1, r;
for(int i=0; i<=60; i++){
if(m%2==1){
a[i]=1;
}
m/=2;
}
for(int i=60; i>=0; i--){
if(a[i]>0){
if(f==-1){
f=i;
r=f;
}
else{
b[i]=f;
f++;
}
}
}
for(int i=0; i<=60; 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... |