#include "bits/stdc++.h"
#include "perm.h"
// #include "grader.cpp"
#define ll long long
using namespace std;
vector <int> v;
void f(int x) {
for(auto &i : v) {
i += x;
}
for(int i = 0; i < x; i++) {
v.push_back(i);
}
return;
}
vector<int> construct_permutation(ll k) {
v.clear();
k--;
while(k) {
ll k1 = k;
for(ll i = 0; i < 60; i++) {
k1 -= (1LL<<i);
if(k1 < 0) {
f(i);
k1 += (1LL<<i);
k = k1;
break;
}
}
}
return v;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |