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;
//#define int long long
#define pb push_back
#define pii pair<int,int>
#define ss second
#define ff first
#define debu(x) (cerr << #x << " = "<< x << "\n")
std::vector<int> construct_permutation(long long k)
{
//cout << "k is " << k << "\n";
#define int long long
vector<int32_t>ans;
int ochako=0;
int got = 0;
for (int a = 63; a >= 0; a--)
{
if (((((int)1) << a) & (k)))
{
//cout << "ak " << a << " " << k << "\n";
if (!ochako)
{
got = a - 1;
ochako = a;
for (int b = 0; b < a; b++)
{
ans.pb(b);
}
}
}
}
//cout << ochako << "ochako\n";
for (int a = ochako-1; a >= 0; a--)
{
//cout << "once " << a << "\n";
if (((((int)1) << a) & (k)))
{
got++;
ans.insert(ans.begin() + a, got);
}
}
/*cout << "outputting the arr:\n";
for (int x : ans)
{
cout << x << " ";
}
cout << "dante\n";*/
#undef int
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |