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;
std::vector<int> construct_permutation(long long k)
{
vector <int> resp;
long long prev = (long long)1;
int cont = 0;
while (prev <= k)
{
cont++;
prev *= (long long)2;
}
cont --;
long long aux = (long long) pow((long long)2, (long long)cont);
int c =(int)(cont)+1;
//cout<<"cont: "<<cont<<endl;
for (long long i = aux + (long long)1; i <= k; i ++)
{
resp.push_back((int)c);
c++;
}
reverse(resp.begin(), resp.end());
//print(resp);
for (int i = 0; i < cont; i++)
{
resp.push_back(i);
}
return resp;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |