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 <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define mn(a,b) min(a,b)
#define mx(a,b) max(a,b)
#define ll long long
ll power[61];
vector<int> construct_permutation(long long k)
{
ll Num = 1;
k -- ;
power[0] = 1;
for(int i = 1;i<=60;i++){
Num*=2;
power[i] = Num;
}
vector<vector<int>>Answer;
vector<int>My_Answer;
int Last =-1;
for(int i = 0 ; i < 10000;i ++) {
My_Answer.push_back(i);
ll Num2 = (i - Last + 1);
if(power[Num2]-1>k){
k-=power[i-Last]-1;
Answer.push_back(My_Answer);
My_Answer.clear();
Last = i;
}
if(k == 0)
break;
}
reverse(Answer.begin(),Answer.end());
vector<int>Ans2;
for(auto x:Answer){
for(auto y: x)Ans2.push_back(y);
}
return Ans2;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |