# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
982727 | vjudge1 | Permutation (APIO22_perm) | C++17 | 1 ms | 428 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>b,r,sol(150,0);
for(int i=0;k;i++){
if(k&1)b.push_back(i);
k/=2;
}
for(int i=0;i<b.back();i++){
r.push_back(i*2+1);
sol[i*2+1]=1;
}
b.pop_back();
while(!b.empty()){
r.push_back(b.back()*2);
sol[b.back()*2]=1;
b.pop_back();
}
for(int i=0,p=0;i<40;i++)
if(sol[i]==1)sol[i]=p,p++;
for(int i=0;i<r.size();i++){
r[i]=sol[r[i]];
}
return r;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |