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>
typedef long long ll;
#define pb push_back
using namespace std;
vector<int> construct_permutation(ll k)
{
vector<int>v;
ll mx=0;
k-=2;
v.pb(0);
while(k-(1ll<<(mx+1))>=0)
{
v.pb(++mx);
k-=(1ll<<mx);
}
for(int i=v.size()-1; i>=0; i--)
{
if(k-(1ll<<(1ll*v[i]))>=0)
{
k-=(1ll<<(v[i]));
v.insert(v.begin()+i, ++mx);
}
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |