This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma")
#include<bits/stdc++.h>
// #include "perm.h"
using namespace std;
vector<int> construct_permutation(long long k)
{
k--;
int sz = 0;
for(int i = 0; i<62; i++){
if(k & (1ll<<i)) sz+=i+1;
}
for(int i = 0; i<sz; i++){
// k-=sz-i;
}
// sz--;
vector<int> v;
for(int i = 0; i<sz; i++) v.push_back(i);
reverse(v.begin(),v.end());
// for(int i = 0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl;
int act = 0;
for(int i = 0; i<62; i++){
if(k & (1ll<<i)){
reverse(v.begin()+act,v.begin()+act+i);
act++;
act+=i;
}
}
// if(k%2 == 1) v.pop_back();
// for(int i = 0; i<v.size(); i++) cout<<v[i]<<" "; cout<<endl;
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |