#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 = 59;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[id]){
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 |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |