이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |