# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
699855 | sharaelong | Permutation (APIO22_perm) | C++17 | 2 ms | 340 KiB |
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>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
vector<int> construct_permutation(ll k) {
int pow = 0;
while ((1ll << pow) <= k) pow++;
pow--;
int cnt = pow;
vector<int> arr(pow, -1);
for (int i=pow-1; i>=0; --i) {
if (k & (1ll << i)) {
arr[i] = pow++;
}
}
vector<int> ret;
for (int i=0; i<arr.size(); ++i) {
if (arr[i] != -1) ret.push_back(arr[i]);
ret.push_back(i);
}
return ret;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |