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 pb(x) push_back((x))
using namespace std;
using ll = long long;
std::vector<int> construct_permutation(long long k) {
vector<int> x;
ll currSum = 1;
for (int i = 0; currSum + (1 << i) <= k; i++) {
x.pb(i);
currSum += (1 << i);
}
for (int i = 1; i <= (k - currSum); i++) x.pb(-i);
for (int& i : x) i += k - currSum;
return x;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |