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)
{
int l = log2(k);
cout << l << endl;
vector<int> sol(l);
iota(sol.begin(), sol.end(), 0);
for (int i = l-1; i >= 0; i--)
{
if (k&(1LL<<i))
{
sol.push_back(0);
for (int j = sol.size()-1; j >i; j--)
{
sol[j] = sol[j-1];
}
sol[i] = l++;
}
}
return sol;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |