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>
#define ll long long
#define F first
#define S second
#define pii pair<int, int>
const int mod = 1e9 + 7;
const int mxN = 1e4 + 100;
using namespace std;
std::vector<int> construct_permutation(long long k)
{
vector<int>ans;
bool vis[64] = {};
int n = -1;
for(int i = 60;i >= 0;i--){
if((k >> i) % 2){
if(n == -1) n = i;
else vis[i] = 1;
}
}
vector<int>v;
int id = 0;
for(int i = 0;i < n;i++){
if(vis[i]){
v.push_back(id);
id++;
}
ans.push_back(id);
id++;
}
while(v.size()){
ans.push_back(v.back());
v.pop_back();
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |