#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 |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Partially correct |
1 ms |
348 KB |
Partially correct |
6 |
Correct |
1 ms |
348 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Partially correct |
2 ms |
348 KB |
Partially correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Partially correct |
2 ms |
344 KB |
Partially correct |
11 |
Partially correct |
2 ms |
348 KB |
Partially correct |
12 |
Partially correct |
1 ms |
348 KB |
Partially correct |
13 |
Partially correct |
2 ms |
348 KB |
Partially correct |