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 <vector>
#include <numeric>
#include <algorithm>
#include "perm.h"
using namespace std;
#define ll long long
vector<int> construct_permutation(ll k) {
int curr = 0;
for (int i = 59; i >= 0; i--) {
if (k & (1ll << i)) {
curr = i;
break;
}
}
vector<int> ret(curr);
iota(ret.begin(), ret.end(), 0);
for (int i = curr - 1; i >= 0; i--) {
if (k & (1ll << i)) {
ret.insert(ret.begin() + i, curr);
curr++;
}
}
return ret;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |