# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
575916 | SHZhang | Permutation (APIO22_perm) | C++17 | 3 ms | 356 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"
using namespace std;
#define ll long long
vector<int> construct_permutation(ll k)
{
ll maxbit = 0;
for (ll i = 62; i >= 0; i--) {
if (k & (1LL << i)) {
maxbit = i; break;
}
}
vector<int> ops;
for (ll i = maxbit - 1; i >= 0; i--) {
ops.push_back(0);
if (k & (1LL << i)) ops.push_back(1);
}
vector<int> ans;
for (int i = 0; i < ops.size(); i++) {
if (ops[i] == 0) {
ans.push_back((int)ans.size());
} else {
for (int j = 0; j < ans.size(); j++) ans[j]++;
ans.push_back(0);
}
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |