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<iostream>
#include"perm.h"
using namespace std;
typedef long long ll;
vector<int>construct_permutation(ll k){
k--;
vector<int>res;
for(int i=63;i>0;i--){
while((1LL<<i)-1<=k){
k-=(1LL<<i)-1;
int start=(int)res.size();
int end=start+i;
for(int j=end-1;j>=start;j--)
res.push_back(j);
}
}
for(int&i:res){
i=(int)res.size()-i-1;
cout<<i<<" ";
}
cout<<"\n";
return res;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |